I would like to know how to write a pattern for a regex in Razor/MVC3. I have been searching how to write the pattern but since I didn't know anything about MVC/Razor I only found a regex pattern for
characters only
^[a-zA-Z]+$
numbers only
^[0-9]*$
character and numbers only
^\w+$
email address.
/\S+@\S+\.\S+/
Those patterns I found are not the one I am looking for. I would like to create a pattern which will exempt these characters "&';,<>
.
I thought of one way doing it. Like this:
^[a-zA-Z0-9_!#$%()-=~^|+and so on..]*$
Do I have to list all the characters just to exempt those? Or there is more an efficient way of doing it?