Regex to Accept Alphanumeric and Some Special Character in Javascript? [Closed]
I Have a Javascript Regex Like This: /^[\X00-\X7F]*$/ I Want to Modify This Regex So That It Accept All Capital and Non-Capital Alphabets, All the Numbers and...
I have a Javascript regex like this:
/^[\x00-\x7F]*$/
I want to modify this regex so that it accept all capital and non-capital alphabets, all the numbers and some special characters: - , _, @, ., /, #, &, +.
How can I do this?
I forgot to mention. This should also accept whitespace.
You could use:
/^[-@.\/#&+\w\s]*$/
Note how this makes use of the character classes \w and \s.
EDIT:- Added \ to escape /