日期:2014-05-16 浏览次数:20894 次
<%
function RP(byval str)
if isnull(str) then exit function
dim re, reWhite, i, Matches, Match, MyArray()
set re = new RegExp
re.IgnoreCase = true
re.Global = true
re.Pattern = "(?:<img[\s\S]*?>)"
set reWhite = new RegExp
reWhite.Pattern = "8769887
------解决方案--------------------
8769886"
Set Matches =re.Execute(str)
i = 0
For Each Match in Matches
ReDim Preserve MyArray(i)
MyArray(i) = Match.Value
str = replace(str, Match.Value, "<@#"&i&"#@>")'
i = i + 1
Next
re.Pattern = "\d{4,}"
' 开始替换
Set Matches =re.Execute(str)
For Each Match in Matches
if not reWhite.test(Match.Value) then
str = replace(str, Match.Value, left(Match.Value, 3) & string(len(Match.Value)-3, "*"))
end if
Next
' 结束替换
if i > 0 then
for i = 0 to ubound(MyArray)
str = replace(str, "<@#"&i&"#@>", MyArray(i))
next
end if
RP = str
end function
s="1348769887<br/><img src='8769887.jpg'>8769887<br/>134988727764<br/><img src='87691887.jpg'>134988727764"
response.Write RP(s)
%>