ASP.Net RegulareExpressionValidator正则表达式和IE6,7 [英] ASP.Net RegulareExpressionValidator Regular Expression & IE6,7

查看:116
本文介绍了ASP.Net RegulareExpressionValidator正则表达式和IE6,7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在使用ASP.Net的RegularExpressionValidator来验证电子邮件地址.但这在IEv6和IEv7中不起作用.
经过研究,尽管我发现罪魁祸首是前瞻性的,但未能成功将其从正则表达式中删除并获得可在所有版本的IE中运行的常规正则表达式.

我当前正在使用的正则表达式是:

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:

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




那里的任何正则表达式大师都可以帮助我删除前瞻/后顾之忧,并获得等效的正则表达式或可以指向正确方向的链接.

Thnx
为您的时间




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

推荐答案

%&'* +/=?^ _`{|}〜] |(?<!\.)\.)* )(?<!\.)" + @"
%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)" + @"@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]


";




那里的任何正则表达式大师都可以帮助我删除前瞻/后顾之忧,并获得等效的正则表达式或可以指向正确方向的链接.

Thnx
为您准备的时间




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


获取 Expresso [
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})


这篇关于ASP.Net RegulareExpressionValidator正则表达式和IE6,7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆