网站URL的正则表达式ASP.NET [英] Regex for website URL ASP.NET
本文介绍了网站URL的正则表达式ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个能够验证以下内容的电子邮件:
http://google.com
https://googwl.com
http://www.google.com
https://www.google.com
www.google.com
www.google .com.eg
www.google.ca
并且不验证以下内容:
google
www.google
google.com
解决方案
请查看以下链接以获取更多信息。
网址验证器
如何验证带有正则表达式的URL
更新
(http | ftp | https):\ / \ / [ \\w\ -_] +(\ [\w\ -_] +。)+([\w\-\,@ ^ =%放大器;放大器;:/?〜\ +#] * [\w\-\ @ ^ =%安培;安培; /〜\ +#])
^ ((http | https)://)?([\\\ - ] + \。)+ [\ w] +(/ [\\\ - ./?] *)?
I need a ergec that validates the following:
http://google.com
https://googwl.com
http://www.google.com
https://www.google.com
www.google.com
www.google.com.eg
www.google.ca
and doesn't validate the following:
google
www.google
google.com
解决方案
Please check below links for more info.
URL Validator
How to validate URLs with regular expressions
UPDATE
(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?
^((http|https)://)?([\w-]+\.)+[\w]+(/[\w- ./?]*)?
这篇关于网站URL的正则表达式ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文