当前位置:主页 > 查看内容

asp 正则 过滤重复字符串的代码

发布时间:2021-07-05 00:00| 位朋友查看

简介:比如 1223445677777778aabbcccccccccc 经过过滤之后就是12345678abc 复制代码 代码如下: % '过滤重复 Function norepeat(Str) Dim RegEx If IsNull(Str) Or Str="" Then Exit Function Set RegEx=New RegExp RegEx.Global = True RegEx.IgnoreCase=True RegE……
比如 1223445677777778aabbcccccccccc 经过过滤之后就是12345678abc
复制代码 代码如下:

<%
'过滤重复
Function norepeat(Str)
Dim RegEx
If IsNull(Str) Or Str="" Then Exit Function
Set RegEx=New RegExp
RegEx.Global = True
RegEx.IgnoreCase=True
RegEx.MultiLine = True
RegEx.pattern="(.)\1+"
str=regEx.replace(str,"$1")
Set RegEx=Nothing
Norepeat=str
End Function
'示例
s="1223445677777778aabbcccccccccc"
response.write Norepeat(s)
%>

原文链接:https://m.jb51.net/article/20353.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:ASP 正则函数替换分页后的参数 下一篇:没有了

推荐图文


随机推荐