Regex to accept alphanumeric and some special character in Javascript? [closed]

I have a Javascript regex like this:


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?




/^[ [email protected]/#&+-]*$/

You can also use the character class \w to replace A-Za-z0-9_


I forgot to mention. This should also accept whitespace.

You could use:

/^[[email protected]\/#&+\w\s]*$/

Note how this makes use of the character classes \w and \s.

EDIT:- Added \ to escape /


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.