I need to define a regular expression that accepts Alphanumeric and the following special characters:
@#$%&*()-_+][‘;:?.,!
I’ve come up with:
string pattern = @"[a-zA-Z0-9@#$%&*+\-_(),+':;?.,![]\s\\/]+$";
But this doesn’t seem to be working. Can someone please let me know what is missing?
The
[]in the middle need to be escaped*:You also probably want to anchor the start of the string with a
^.* Probably just the
]but I like to do both for balance.