Regex and browser dependency
Why does the following regex:
var regex = /[^a-zA-Z0-9,-\s]/g
not work in Firefox and IE, but works in Safari and Chrome.
But if I change it to:
var regex = /[^a-zA-Z0-9-\s,]/g
It works on all the above-mentioned browsers.
Can anybody please explain why the comma (,) is the bad guy here?
I just tested out this script and it worked on Internet Explorer(8), Chrome and Firefox: /[^a-zA-Z0-9\s,-]/g. The above up votes for my comment makes me believe I am right.