需要Reg Ex帮助 [英] Reg Ex Help Needed

查看:163
本文介绍了需要Reg Ex帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi,

我正在使用正则表达式验证器来验证URL。我在控件的验证表达式属性中使用以下reg ex

   i am using Regular Expression Validator to validate the URL. I am using the following reg ex in the Validation Expression Property of the control

((http | ftp | https):\ / \ / w {3} [\d] * |(HTTP | FTP | HTTPS):\ / \ / | W {3} [\d] *)([\w\d\._\-#\(\\ \\)\ [\] \\;:] + @ [\w\d\._\-#\(\)\ [\] \\, ;:])([A-Z0-9] +)* [az\-0-9] +([AZ] {2,3})[AZ] {2,6-}(:[?。? 0-9] +)(\ / [\ /α-z0-9\._\ - , - ] +)* [A-z0-9\-_\.\s\ %] +(\?[a-z0-9 =%& amp; \。\ - ,#] +)?

((http|ftp|https):\/\/w{3}[\d]*.|(http|ftp|https):\/\/|w{3}[\d]*.)([\w\d\._\-#\(\)\[\]\\,;:]+@[\w\d\._\-#\(\)\[\]\\,;:])?([a-z0-9]+.)*[a-z\-0-9]+.([a-z]{2,3})?[a-z]{2,6}(:[0-9]+)?(\/[\/a-z0-9\._\-,]+)*[a-z0-9\-_\.\s\%]+(\?[a-z0-9=%&\.\-,#]+)?

但它没有验证一个简单的网站比如, http://www.google.com/webhp?complete=1&hl=en

but it is not validating a simple site say, http://www.google.com/webhp?complete=1&hl=en

当我检查文件的索引时,reg ex已更改为,

when i checked the sourse of the file the reg ex has been changed to,

((| | | | | | | | | | | HTTPS):\\ / \\ / | W {3} [\\d] *)([\ \\\\\\\\\-#\\( \\)\\ [\\] \\\\;:] + @ [\\w\\\ \\d\\._\\-#\\(\\)\\ [\\] \\\\;:])([?一个-Z0-9] +)* [az\\-0-9] +([AZ] {2,3})[AZ] {2,6-}(:。?[0-9] + )(\\ / [\\ /α-z0-9\\._\\ - ,] +)* [A-z0-9\\-_\\\ \\.\\s\\%] +(\\ [A-Z0-9 =%&安培; \\.\\ - ,#] +) ?

((http|ftp|https):\\/\\/w{3}[\\d]*.|(http|ftp|https):\\/\\/|w{3}[\\d]*.)([\\w\\d\\._\\-#\\(\\)\\[\\]\\\\,;:]+@[\\w\\d\\._\\-#\\(\\)\\[\\]\\\\,;:])?([a-z0-9]+.)*[a-z\\-0-9]+.([a-z]{2,3})?[a-z]{2,6}(:[0-9]+)?(\\/[\\/a-z0-9\\._\\-,]+)*[a-z0-9\\-_\\.\\s\\%]+(\\?[a-z0-9=%&\\.\\-,#]+)?

这就是为什么它没有验证网址的原因。

is this the reason why it is not validating the url's.

请告诉我是否要更改正则表达式或验证器中的设置。

please let me know whether i want to change the regex or the setting in the validator.

注意:我想验证互联网和内联网地址。

NOTE: i want to validate internet and intranet addresses.

希望有人可以帮助我。谢谢。

Hope some one can help me. Thank you.

推荐答案

这是一个asp问题吗?您正在运行什么平台?
Is this an asp issue? What platform are you running on?


这篇关于需要Reg Ex帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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