A Regular Expression to match non-alphanumeric characters. This can be useful to match any character that is not a number of letter.
/[^a-zA-Z0-9]/
Explain:
[]
Character set. Match any character in the set.- a-z Range. Matches a character in the range “a” to “z”. Case sensitive.
- A-Z Range. Matches a character in the range “A” to “Z”. Case sensitive.
- 0-9 Range. Matches a character in the range “0” to “9”. Case sensitive.
Matches:
- @
- #
- Space
Non-matches:
- 12345
- abcde
See Also:
- Regular Expression To Check Non-digit Characters
- Regular Expression To Match Non-ASCII Characters
- Regular Expression To Check Non-digit Characters
- Alphanumeric Regular Expression
- Special Characters Regular Expression
- Regular Expression To Match Only Alphabets And Spaces
- Regular Expression To Match Non-numeric Strings