Regular expression for excluding special characters [closed]

I would just white list the characters.

^[a-zA-Z0-9äöüÄÖÜ]*$

Building a black list is equally simple with regex but you might need to add much more characters – there are a lot of Chinese symbols in unicode … 😉

^[^<>%$]*$

The expression [^(many characters here)] just matches any character that is not listed.

Leave a Comment