I need regex to search string for alphanumeric, (, ), -, ., / and ampersand(&).
Right now i m using this regex in client side validation
[^A-Za-z0-9.)(/-\&]
EDIT:
I want to s开发者_StackOverflowearch my string for special characters VAL.search(/[^A-Za-z0-9.)(/-\&]+/g)==-1
Escape the backslash, put the dash at the end of the character class.
[^A-Za-z0-9.)(/\\&-]
Not sure why you included ^
, as this negates the character class.
Try this:
VAL.search(/[^a-zA-Z0-9.()/&-]/g) == -1
精彩评论