Python 正则表达式验证URL
2014-10-09 10:37
351 查看
1. Allow almost any URL ^(https?|ftp|file)://.+$ eg. https://nihao.com/dddni.jpg 2. Require a domain name, and donot allow a username or password ^(https?|ftp)://[a-zA-Z0-9-]+(\.[a-zA-Z0-9]+)+$ eg. https://nihao.com 3. Require a domain name, and donot allow a username or password. Allow the scheme (http or ftp) to be omitted if it can be inferred from the subdomain(www or ftp) ^((https?|ftp)://|(www|ftp)\.)[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+([/?].*)?$ eg. https://nihao.com/dddni.jpg www.nihao.com/dddni.jpg http://www.nihao.com/dddni.jpg 4. Require a domain name and a path that points to an image file. Donot allow a username, password or parameters ^(https?|ftp)://[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+(/[\w-]+)*/[\w-]+\.(gif|png|jpg)$ eg. http://www.nihao.com/dddni.jpg[/code]
相关文章推荐
- Python 正则表达式验证generic url
- Python验证Url地址的正则表达式
- Python验证Url地址的正则表达式
- Python 正则表达式验证时间
- 完美的js验证url(正则表达式)
- python 正则表达式 -- IP地址验证
- Python 正则表达式验证传统日期
- JS之正则表达式验证URL
- C#中使用正则表达式验证Email格式、IP地址格式和URL网址格式
- c#使用正则表达式匹配字符串验证URL示例
- python+正则表达式获取ed2k url
- 多样的Url正则表达式(适合Jquery.validate.js中url验证替换)
- 验证网址URL的正则表达式
- 所有Url的正则表达式,用来验证返回的Url是否符合RFC1738规定
- c#常用正则表达式,验证邮箱,Url,电话号码等
- python 正则表达式判断URL是否合法
- 完美的js验证网址url(正则表达式)
- 正则表达式(4),URL验证---学习编
- 用python正则表达式提取网页的url
- js 正则表达式验证url 网址