需要正则表达式的asp.net网站 [英] Need Regex for asp.net website

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

问题描述

需要正则表达式进行网址验证



规则:



1.即使(http或https)是否包括在内。

2.它不包含其他协议,如ftp,mailto

3.它不应包含子域URL和/之后.com

4. www必须包含在url中

解决方案

试试这个:

 ^(HTTP [S]://)?[。] [W] {3}([。] [A-Z0-9] +)+ [AZ] {1,3} 



在应用此正则表达式模式之前,首先将url转换为小例。


试试这个



http://madskristensen.net/ post / validate-a-url-using-regular-expressions [ ^ ]


Need Regular Expression for url validation

Rules:

1. It should validate even if (http or https) is included or not.
2. it not contain other protocols like ftp, mailto
3. It should not contain sub domain URL's and "/" after .com
4. www is must included in url

解决方案

Try this:

^(http[s]?://)?[w]{3}[.]([a-z0-9]+[.])+[a-z]{1,3}



Convert the url into small case first before applying this regex pattern.


Try this

http://madskristensen.net/post/validate-a-url-using-regular-expressions[^]


这篇关于需要正则表达式的asp.net网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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