您的位置:首页 > 其它

RegReplace(str,regexStr,RepalceStr) 对str 进行正则替换 (转)

2007-08-08 08:54 239 查看
RegReplace(str,regexStr,RepalceStr) 对str 进行正则替换

如:

htmlstr = "123<img src=""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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: