Reputation: 6710
I am using asp.net 3.5 with C# 2008.
I have a textbox and to validate it I have a regular expression validator. For allowing Alpha-numerics, space and certain special character I am using following regular expression ValidationExpression="[a-zA-Z0-9_. ,'#&$~@!-]*"
Now I want to allow double quotes (")
as a special character. For this I have tried ValidationExpression="[a-zA-Z0-9_. ,'#&$~@!\"-]*"
and ValidationExpression="[a-zA-Z0-9_. ,'#&$~@!"-]*"
etc. but gives Parser Error.
Can anyone help?
Upvotes: 0
Views: 2565
Reputation: 32797
You need to escape "
using ""
or "
Your regex should be
^[\w. ,'#&$~@!"-]*$
\w
is similar to [a-zA-Z\d_]
Upvotes: 3