Error in ValidationExpression when using in XSLT
My XSLT shows that there is error in the below line, but i could not figure it out
<asp:RegularExpressionValidator ID="validatorEmail{@id}" runat="server" Display="Dynamic" ControlToValidate="{@id}" Erro开发者_Python百科rMessage="username@domain.com"
ValidationExpression="^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$" />
Error Message:
Expected token '}', found ','. ...+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2 -->,<-- }))@((([0-1]?[0-9]{1,2}|25[0-5]|... Forms.xslt
What is wrong with this?
In XSLT {
and }
are used to inject dynamic values in attribute value templates. You need to double them to escape them in your regular expression:
ValidationExpression="^(([\w-]+\.)+[\w-]+|([a-zA-Z]{{1}}|[\w-]{{2,}}))..."
精彩评论