众果搜-ZhongGuoSou.com-整合大型搜索引擎资源,一次输入搜索全球所有搜索引擎,致力于网络在线工具的编写与普及 - qy188千亿国际手机版【下载】

众果搜的博客

脚踏大地,仰望星空,致力于财经投资网站导航与在线网络工具的开发与普及

Search(博客qy188千亿国际手机版【下载】)

热文排行

最近发表

最新评论及回复

« 正则表达式库(Email地址验证)选手得分的快速计算 »

正则表达式库(URI验证第一部分)

 这里列出的正则表达式是来自国外的正则表示网站,其中,同种的正则表达式,按照使用频率的多寡的先后顺序排列,你可以根据需要选用。在选用后,你可以使用正则表达式在线测试工具在线进行测试调整:http://www.zhongguosou.com/computer_question_tools/test_regex.aspx   资源定位符Windows文件名表达式:\A([A-Za-z0-9'~`!@#$%&amp;^_+=\(\){},\-\[\]\;])+?([ A-Za-z0-9'~` !@#$%&amp;^_+=\(\){},\-\[\];]|([.]))*?(?(3)(([ A-Za-z0-9'~`!@#$ %&amp;^_+=\(\){},\-\[\]\;]*?)([A-Za-z0-9'~`!@#$%&amp;^_+=\(\){},\-\[ \];])+\z)|(\z))匹配:Test.txt | T est.txt | Rosco's.Test.txt不匹配:\Folder\Test.txt | T*est.txt | Test. IP地址列表和地址范围表达式:^(((((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])-(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))|((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))),)*)(((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-匹配:    192.168.101.1 | 192.168.101.1-192.168.101.255 | 192.168.101.1-192.168.101.255,192.168.102.12不匹配:999.168.101.1 | 192.168.101.1- | -192.168.101.255 网址:表达式:(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&amp;%_\./-~-]*)?匹配:http://diskusneforum.sk | www.diskusneforum.sk | ftp://123.123.123.123/不匹配:       diskusneforum.sk 特别域名:    ^(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk$匹配:zeropanic.co.uk | z2.co.uk | 1-1.org.uk不匹配:zeropanic.com | z.co.uk | zz.co.uk 文件夹名:    ^[^\\\/\?\*\&quot;\'\&gt;\&lt;\:\|]*$匹配:    321321321 dasds不匹配:       /\3fsdfsd 美元金额:表达式:       ^(\$)?(([1-9]\d{0,2}(\,\d{3})*)|([1-9]\d*)|(0))(\.\d{2})?$匹配:$1,234,567.89 | 1234567.89 | $0.00不匹配:$1,2345,67.89 | $1234,345,678.0 超级链接:\[link="(?<link>((.|\n)*?))"\](?<text>((.|\n)*?))\[\/link\]匹配:[link="http://www.yahoo.com"]Yahoo[/link]不匹配:[link]http://www.yahoo.com[/link] | [link=http://www.yahoo.com]Yahoo[/link] 邮箱链接:表达式:((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+)匹配:    http://www.aspemporium.com | mailto:dominionx@hotmail.com | ftp://ftp.test.com不匹配:www.aspemporium.com | dominionx@hotmail.com | bloggs 长文件名校验(Windows标准)表达式^[^\\\./:\*\?\"<>\|]{1}[^\\/:\*\?\"<>\|]{0,254}$匹配:    abcd.jpg | a b239.abcd ef12983 298 | a....23498不匹配:       .abcde.jpg | abcde?.jpg | c:\abcde.jpg 匹配所有的顶级域名(根据IANA2007-77-14的规范)表达式:(a(?:[cdefgilmnoqrstuwxz]|ero|(?:rp|si)a)|b(?:[abdefghijmnorstvwyz]iz)|c(?:[acdfghiklmnoruvxyz]|at|o(?:m|op))|d[ejkmoz]|e(?:[ceghrstu]|du)|f[ijkmor]|g(?:[abdefghilmnpqrstuwy]|ov)|h[kmnrtu]|i(?:[delmnoqrst]|n(?:fo|t))|j(?:[emop]|obs)|k[eghimnprwyz]|l[abcikrstuvy]|m(?:[acdeghklmnopqrstuvwxyz]|il|obi|useum)|n(?:[acefgilopruz]|ame|et)|o(?:m|rg)|p(?:[aefghklmnrstwy]|ro)|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|t(?:[cdfghjklmnoprtvwz]|(?:rav)?el)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw])匹配:    所有的ccTLDs (Country-Code Top-Level Domains) | all gTLDs (Generic Top-Level Domains) | .arpa不匹配:       不存在的T.L.D.s 域名表达式:^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$匹配:regexlib.com | this.is.a.museum | 3com.com不匹配:notadomain-.com | helloworld.c | .oops.org 完整的和压缩的IPv6地址表达式:       ^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$匹配:    FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 | 1080::8:800:200C:417A | ::FFFF:129.144.52.38不匹配:       FEDC::7654:3210::BA98:7654:3210 | FEDC:BA98:7654:3210 | :: 网络协议:表达式:       (\s|\n|^)(\w+://[^\s\n]+)匹配:http://www.acme.com | ftp://ftp.acme.com/hede | gopher://asdfasd.asdfasdf不匹配:&lt;a href=&quot;http://acme.com&quot;&gt;http://www.acme.com&lt;/a&gt; rel="nofollow" | &lt;br&gt;http://www.acme.  简单的匹配10进制IP地址,但不验证地址表达式:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}匹配:192.168.1.1 | 10.2.234.1 | 66.129.71.122不匹配:192.168.1 | 10.2.1234.1 | 66 129 71 122 域名或主机名表达式:^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$ 匹配:3SquareBand.com | asp.net | army.mil不匹配:$SquareBand.com | asp/dot.net | army.military  Windows路径和无效UNC路径表达式:^([a-zA-Z]\:) (\\{1}| ((\\{1}) [^\\] ([^/:*?&lt;&gt;&quot;|]*(?&lt;![ ])))+)$匹配:c:\34\445\546\3.htm | C:\不匹配:       \\qaz | c:\Ram&lt;\ | C: or c:\\ or \\  文件扩展名表达式:       (?!\.)[a-z]{1,4}$匹配:file.jpg | file.c | file.gif不匹配:       file.34  域名地址:    ^(((ht|f)tp(s?))\://)?((([a-zA-Z0-9_\-]{2,}\.)+[a-zA-Z]{2,})|((?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(\.?\d)\.)){4}))(:[a-zA-Z0-9]+)?(/[a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~]*)?$匹配:    this.com | https://this.com:8080/this/this.htm | ftp://255.255.255.255/不匹配:       .this.com | https://this.com:/ | ftps://255.256.255.255/  匹配URL字符串表达式:       \b([\d\w\.\/\+\-\?\:]*)((ht|f)tp(s|)\:\/\/|[\d\d\d|\d\d]\.[\d\d\d|\d\d]\.|www\.|\.tv|\.ac|\.com|\.edu|\.gov|\.int|\.mil|\.net|\.org|\.biz|\.info|\.name|\.pro|\.museum|\.co)([\d\w\.\/\%\+\-\=\&amp;\?\:\\\&quot;\'\,\|\~\;]*)\b匹配:http://210.50.2.215/sd_new/WebBuilder.cgi?RegID=7449046&amp;First=Ok&amp;Upt=Ok&amp;EditPage=3&amp;S不匹配:       Hmmmm 带端口的IP地址表达式:^((?:2[0-5]{2}|1\d{2}|[1-9]\d|[1-9])\.(?:(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)\.){2}(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)):(\d|[1-9]\d|[1-9]\d{2,3}|[1-5]\d{4}|6[0-4]\d{3}|654\d{2}|655[0-2]\d|6553[0-5])$匹配:127.0.0.1:80 | 255.255.255.0:21 | 1.0.0.0:1不匹配:       0.0.0.0:1 | 256.1.1.1:20 | 127.0.0.1:65536在线进行正则表达式测试调整:http://www.zhongguosou.com/computer_question_tools/test_regex.aspx    
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense

Copyright www.zhongguosou.com. Some Rights Reserved.微信号:MiZhiHeiGeTaXiaoMi