I am trying to make a regular expression for a string that has at least 1 non alphanumeric symbol in it
The code I am trying to use is
Regex symbolPattern = new Regex("?[!@#$%^&*()_-+=[{]};:<>|./?.]");
I’m trying to match only one of !@#$%^&*()_-+=[{]};:<>|./?. but it doesn’t seem to be working.
If you want to match non-alphanumeric symbols then just use
\W|_.This will match anything except 0-9 and a-z. Information on the
\Wcharacter class and others available here (c# Regex Cheet Sheet).