日期:2014-05-17  浏览次数:20848 次

这个表达式用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 ")