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]*$/
精彩评论