软件教程

ASP对字符串正则替换的自定义函数

来源: 本站    类别: 软件教程    日期: 2013/5/2

 

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

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com