Pankaj
Pankaj

Reputation: 10095

Double quotes in regular expression control

In my below mentioned reqular expression, how can i add double quotes ?

 <asp:RegularExpressionValidator SetFocusOnError="true" ID="rev" runat="server"
                                Display="None" ValidationGroup="question" ErrorMessage="" ControlToValidate="txtQuestion"
                                ValidationExpression="^[0-9a-zA-Z-/'? ]+$"> </asp:RegularExpressionValidator>

Upvotes: 2

Views: 2368

Answers (3)

CouncilScribe
CouncilScribe

Reputation: 711

I'm not sure exactly what you are asking but if you are asking how to add quotes to your regular expression I would point you to this cheat sheet.

Upvotes: 0

ykatchou
ykatchou

Reputation: 3727

Did you try

 \&quot;

Cause, it's encoded in HTML.

You have to keep in mind than ASP page are render in XHTML (like XML) and then you should encode regexp in order to have seems correct in XML.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500155

This sounds like it may be an XML question more than regex. Have you tried just using &quot;?

ValidationExpression="^[0-9a-zA-Z-/'?&quot; ]+$">

Upvotes: 6

Related Questions