I am using Jquery to validate my textbox. my particular regex condition is...
/^[A-Za-z.-\s]*$/.. that is alphabets, space, hyphen, and dots.
Issue is it work great and efficiently in Chrome and explorer but firefox gives error for this regex. I checked using firebug. Even it also not work for firefox.
Error: invalid range in character class
To avoid the hyphen having a special meaning (range of characters) you should put it at the end of the character class:
[A-Za-z.\s-]
Alternatively you can escape it:
[A-Za-z.\-\s]
Escape the hyphen:
/^[A-Za-z.\-\s]*$/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With