asp 正则 过滤重复字符串的代码
摘要:比如1223445677777778aabbcccccccccc经过过滤之后就是12345678abc复制代码代码如下:
比如 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)
%>
【asp 正则 过滤重复字符串的代码】相关文章:
★ [js]用JAVASCRIPT正则表达式限制文本字节数的代码
上一篇:
mysql正则表达式 LIKE 通配符
下一篇:
ASP 正则函数替换分页后的参数