Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All

I am using ASP.Net's RegularExpressionValidator to validate email addresses. But this is not working in IEv6 and IEv7.
After research although I found the culprit is lookahead and lookbehind but was unsuccessful in removing them from the regex and get a general regex that runs in all versions of IE.

Regex that I am currently using is:

C#
string pattern = @"^(?!\.)(""([^""\r\\]|\\[""\r\\])*""|"
              + @"([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)"
              + @"@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$";



Any regex master there who can help me remove lookaheads/lookbehind and get me an equivalent regex or a link that can point me in the right direction.

Thnx
for your time
Posted

Get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.

It also has sample expressions: It's one for emails is:
([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})
 
Share this answer
 
After not finding a regex without lookaround, I used server side validation
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900