Dim regex As Object Set regex = CreateObject("vbscript.regexp") With regex .Global = True .IgnoreCase = True .MultiLine = True .Pattern = "[/d*]+" End With str_end = regex.Replace("a123c11", "b") '正则方法一 bool_end = regex.test("a1") '正则方法二 Dim matches As Object Set matches = regex.Execute("a1b2c3") '正则方法三 For Each Match In matches s = Match.Value Next For i = 0 To matches.Count - 1 s = matches(i).Value Next i
提取信息中的网络链接:
(h|H)(r|R)(e|E)(f|F) *= *('|")?(/w|//|//|/.)+('|"| *|>)?
提取信息中的邮件地址:
/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*
提取信息中的图片链接:
(s|S)(r|R)(c|C) *= *('|")?(/w|//|//|/.)+('|"| *|>)?
提取信息中的ip地址:
(/d+)/.(/d+)/.(/d+)/.(/d+)
提取信息中的中国手机号码:
(86)*0*13/d{9}
提取信息中的中国固定电话号码:
(/(/d{3,4}/)|/d{3,4}-|/s)?/d{8}
提取信息中的中国电话号码(包括移动和固定电话):
(/(/d{3,4}/)|/d{3,4}-|/s)?/d{7,14}
提取信息中的中国邮政编码:
[1-9]{1}(/d+){5}
提取信息中的中国身份证号码:
/d{18}|/d{15}
提取信息中的整数:
/d+
提取信息中的浮点数(即小数):
(-?/d*)/.?/d+
提取信息中的任何数字 :
(-?/d*)(/./d+)?
提取信息中的中文字符串:
[/u4e00-/u9fa5]*
提取信息中的双字节字符串 (汉字):
[^/x00-/xff]*
提取信息中的英文字符串:
/w*
1048

被折叠的 条评论
为什么被折叠?



