Friday, September 21, 2012

Email validation error in Windows phone

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 example@example.comfg then it return true. How can I check this type of error in email.

Answers & Comments...

Answer: 1

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}))$"); 
by : Gros Lalohttp://stackoverflow.com/users/826642




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog