以下是asp源码:asp正则提取文本中多个11位国内手机号并去重完整实例201811
<%
Function RegExpTest(patrn, strng)
RetStr ="|"
Dim regEx, Match, Matches ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字符大小写。
regEx.Global = True ' 设置全局可用性。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match in Matches ' 遍历匹配集合并去重。
MatchValue="|"&Match.Value&"|"
if instr(RetStr,MatchValue)>0 then
RetStr = RetStr
else
RetStr = RetStr & Match.Value & "|"
end if
Next
RegExpTest = RetStr
End Function
str="我的手机号是13888888888,或者13999999999,或者13999999999,订单号12345678910防伪号123123456789喜欢"
mobi=RegExpTest("1[3459789][0-9]{9}",str)
response.write mobi
%>