I want to remove all unnecessary commas from the start/end of the string.
eg; google, yahoo,, , should become google, yahoo.
google, yahoo,, ,
google, yahoo
If pos
My take:
var cleanStr = str.replace(/^[\s,]+/,"") .replace(/[\s,]+$/,"") .replace(/\s*,+\s*(,+\s*)*/g,",")
This one will work with opera, internet explorer, whatever
opera, internet explorer, whatever
Actually tested this last one, and it works!