日期:2011-10-25  浏览次数:21097 次

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

如:

htmlstr="123<imgsrc=http://itdowns.com/edu/asp/20070123/""asdf.gif""border=""0"">45<b>6</b>"
htmlstr2=RegReplace(htmlstr,"<(.[^><]*)>","")

返回htmlstr2为123456

FunctionRegReplace(Str,PatternStr,RepStr)
 DimNewStr,regEx
 NewStr=Str
 ifisnull(NewStr)then
 RegReplace=""
 exitfunction
 endif
 SetregEx=NewRegExp
 regEx.IgnoreCase=True
 regEx.Global=True
 regEx.Pattern=PatternStr
 NewStr=regEx.Replace(NewStr,RepStr)
 RegReplace=NewStr
endfunction