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?

Answers


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.


Need Your Help

Firefox CSS3 isosceles triangle rendering issues

css3 firefox geometry

I'm trying to create a isosceles triangle using CSS3 and looks like Firefox can't render them properly?

enhance the wordpress security to access directly folder

php wordpress security

once i upload the new image to wordpress the new directory will be created once the month change (like in aug /var/www/mysite/wp-content/uploads/2015/08). which not contains the index.php file so e...