function repnum(strng) '以数组返回
i = 0
set regex = new regexp
regex.pattern = "(d+)" '"[0-9]"
regex.ignorecase = true
regex.global = true
set matches = regex.execute(strng)
for each match in matches
'retstr = retstr &"
"& match.value
if len(match.value)>=5 then
strng = replace(strng, right(match.value,4),"***")
end if
i = i + 1
next
repnum = strng
end function
使用的时候就直接<%=repnum(content)%>就行了,运行结果是content字符串中的一些数字被换成***,起到隐藏联系方式的作用。如果觉得留下的数字多了,自己改一下这个函数里面相应的数字。
再补充一个相关的函数
功能:asp教程正则表达式提取字符串中所有的数字。
参数:strng为要提取的内容
function regexptest(strng) '以数组返回
i = 0
set regex = new regexp
regex.pattern = "(d+)" '"[0-9]"
regex.ignorecase = true
regex.global = true
set matches = regex.execute(strng)
for each match in matches
retstr = retstr &"
"& match.value '输出提取出来的数字
i = i + 1
next
regexptest = retstr
end function
使用方法<%=regexptest(content)%>,运行结果是content字符串中的所有数字,并换行。
疯狂医院达什医生中文版(Crazy Hospital)
疯狂医院达什医生最新版是一款医院模拟经营类游戏,逼真的场景画
宝宝庄园官方版
宝宝庄园官方版是一款超级经典好玩的模拟经营类型的手游,这个游
桃源记官方正版
桃源记是一款休闲娱乐类的水墨手绘风格打造的模拟经营手游。玩家
长途巴士模拟器手机版
长途巴士模拟器汉化版是一款十分比真好玩的大巴车模拟驾驶运营类
房东模拟器最新版2024
房东模拟器中文版是一个超级有趣的模拟经营类型的手游,这个游戏