I want to write a simple regular expression to check if in given string exist any special character. My regex works but I don\'t know why it also includes all numbers, so wh
If you only rely on ASCII characters, you can rely on using the hex ranges on the ASCII table. Here is a regex that will grab all special characters in the range of 33-47, 58-64, 91-96, 123-126
[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]
However you can think of special characters as not normal characters. If we take that approach, you can simply do this
^[A-Za-z0-9\s]+
Hower this will not catch _ ^ and probably others.