1

I have a e-mail address validator but I need to add special characters as valid for example ü, ç... Because users in Turkey (or anywhere else) can have a web site url like: hasangürsoy.com My code is below:

<asp:TextBox ID="tEMail" runat="server" />
<asp:RequiredFieldValidator ID="rfvEMail" runat="server"
    ControlToValidate="tEMail" ErrorMessage="* required" />
<asp:RegularExpressionValidator ID="revEMail" runat="server"
    ControlToValidate="tEMail" ErrorMessage="* invalid"
    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
HasanG
  • 12,734
  • 29
  • 100
  • 154
  • Okay I've rewriten the expression like this: \w+[\wçığöşü]+([-+.']\w+)*@\w+[\wçığöşü]+([-.]\w+)*\.\w+([-.]\w+)* the only problem is the e-mail address and domain should start with normal character (not çığöşü). If I solve this problem the work will be done – HasanG Mar 31 '10 at 06:28

3 Answers3

1

\w+([ü,ç,other characters here][-+.']\w+)*@\w+([ü,ç,,other characters here][-.]\w+)*\.\w+([ü,ç,,other characters here][-.]\w+)*
Prashant Lakhlani
  • 5,758
  • 5
  • 25
  • 39
1

You can use the special format "\u00fc" to specify the hex value of the char. Look at the table here http://www.ascii.cl/htmlcodes.htm

Jacee
  • 186
  • 2
  • 7
0

Okay I did it. But be careful, if you use this e-mail validation expression the mail address can't pass validation when you try to use it for example ReplyTo address.

<asp:RegularExpressionValidator ID="revEMail" runat="server"
    ControlToValidate="tEMail" ErrorMessage="* invalid" Display="Dynamic"
    ValidationExpression="\w*[\wçığöşü]+([-+.']\w+)*@\w*[\wçığöşü]+([-.]\w+)
    *\.\w+([-.]\w+)*" />
HasanG
  • 12,734
  • 29
  • 100
  • 154