2012-03-21 59 views
6

是否有任何人知道如何包含常规expression.I双引号写这个正则表达式,但不能包括双引号如何包括双引号(“)在正则表达式

<asp:RegularExpressionValidator ID="KeywordsRegex" runat="server" 
ValidationExpression="^[+\-\!\(\)\:\^\[\]\{\}\~\*\?\&&\||].*$" 
ControlToValidate="Keywords" ErrorMessage="Search keyword is not valid." 
Text="*"></asp:RegularExpressionValidator> 
+0

这解决它definitelly \ 22 \ 42。 http://stackoverflow.com/questions/1616190/quotes-inside-validationexpression-for-regularexpressionvalidator – 2015-01-19 19:28:14

回答

1

你试图逃避?用反斜杠双引号

0

您可能需要双逃逸,如\\\"

0

去逃避它: 替换每个“通过\”

10

尝试加上反斜杠(\)后跟&quot;。这将是正确的XML。

+1

感谢奥斯卡broman现在你的绝招是工作它看起来像这样的 2012-03-22 10:31:40