首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

这个表达式用RegExp对象如何替换过滤

2012-04-11 
这个表达式用RegExp对象怎么替换过滤字符串内容如:欢迎你来 ahrefhttp://www.youname.com/info.asp?idz

这个表达式用RegExp对象怎么替换过滤
字符串内容如:欢迎你来 <a   href=http://www.youname.com/info.asp?id=zj   target=_blank> 专家 </a> 论坛
我要把上面这个字符串的内容替换成:
欢迎你来 <a   href=http://www.youname.com/info-zj.shtml   target=_blank> 专家 </a> 论坛
有没有看明白,其实就是把   .asp?   ->   -   在   zj   后加.shtml

Function   ReplaceTest(patrn,   replStr,strName)
    Dim   regEx,   str1                              
    str1   =strName
    Set   regEx   =   New   RegExp                            
    regEx.Pattern   =   patrn                              
    regEx.IgnoreCase   =   True                              
    ReplaceTest   =   regEx.Replace(str1,   replStr)                
End   Function
不过这个参数该怎么配置传递

[解决办法]
regEx.Pattern = "\.asp\?id=([\s|\S]*)?\s "
ReplaceTest = regEx.Replace(str1, "-$1.shtml ")

热点排行