Search code examples
c#silverlightwindows-phoneemail-validation

Email validation error in Windows phone


In my application I am usinfg an email validation. I am using this for email verification. It checks only for the entered text is in a normal email format. When I am entering an email like [email protected] then it return true. How can I check this type of error in email.


Solution

  • If the problem is that you think that comfg is wrong and it should be 3 characters max like in com, the simply change the Regex like that:

    Regex.IsMatch(strIn, 
                  @"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + 
                  @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,3}))$");