ASP自定义函数对字符串正则替换
网络整理 - 09-04
RegReplace(str,regexStr,RepalceStr)对str进行正则替换 如:
htmlstr = "123<img src=http://www.zzsky.cn/build/content/""asdf.gif"" border=""0"">45<b>6</b>"
htmlstr2 = RegReplace(htmlstr,"<(.[^><]*)>","")
返回htmlstr2为123456
Function RegReplace(Str,PatternStr,RepStr)
Dim NewStr,regEx
NewStr = Str
if isnull(NewStr) then
RegReplace = ""
exit function
end if
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern=PatternStr
NewStr = regEx.Replace(NewStr,RepStr)
RegReplace = NewStr
end function