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

asp下过滤重复字符串的代码,有时候我们需要过滤一些重复的字符串,下面的代码即可解决这个问题
比如 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)
%>

http://www.corange.cn/archives/2008/11/2241.html

转载于:https://www.cnblogs.com/ajuanabc/archive/2009/10/11/2462885.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值