I\'m trying to figure out how to filter out duplicates in a string with a regular expression, where the string is comma separated. I\'d like to do this in javascript, but I\
I don't use Regular Expressions for that.
Here's the function I use. It accepts a string containing comma separated values and returns an array of unique values regardless of position in the original string.
Note: If you pass CSV string containing quoted values, Split will not treat commas inside quoted values any differently. So if you want to handle real CSV, you are best to use a 3rd party CSV parser.
function GetUniqueItems(s)
{
var items=s.split(",");
var uniqueItems={};
for (var i=0;i