« 背景渐变case 的用法 »

asp自定义函数:对字符串正则替换

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

如:
htmlstr = "123<img src="http://www.ajaxstu.com/Files/File/2007-11/25/F81838A188DFD33KH1.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
原创文章如转载,请注明:转载自悠悠博客 [ http://www.ajaxstu.com/ ]

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。