Reputation: 1039
I want to add client side regex validation to inlcude en-dash(–) and em-dash(—)
<asp:RegularExpressionValidator ID="NameRegExValidator" runat="server" ValidationExpression="[a-zA-Z\d.,!&/\(\)#\$?£àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ€\|%\^\*@`~\+;:\-'\s\\"]+" ErrorMessage="Illegal Characters" ControlToValidate="Name" ></asp:RegularExpressionValidator>
can anyone help me out ?
Upvotes: 2
Views: 2366
Reputation:
I'm not a .net expert, but couldn't you just put the characters in the class?
Or put the codepoint in the class, or thier char references (xhtml/xml).
en dash – U+2013 – – or –
em dash — U+2014 — — or —
[a-zA-Z\d.,!&/\(\)#\$?£àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ€\|%\^\*@`~\+;:\-'\s\\"–—]+
[a-zA-Z\d.,!&/()#\$?£àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇ’ñ€\|%\^*@`~+;:-'\s\"–—]+
Upvotes: 1