MyString="一群喧闹<a href=""http://www.baidu.com"">百度</a>来到了的<a href=""#"">大学生</a>人"
我想把 有链接的 百度 替换成纯文字的百度
别的链接不替换
怎么替换?
------解决方案--------------------
MyString="一群喧闹<a href=""http://www.baidu.com"">百度</a>来到了的<a href=""#"">大学生</a>人"
set rx=new regexp
rx.ignorecase=true
rx.global=true
rx.pattern="<a[^>]+>百度</a>"
MyString=rx.replace(MyString,"百度")
set rx=nothing
response.write MyString
------解决方案--------------------
直接替换,不用正则。
MyString="一群喧闹<a href=""http://www.baidu.com"">百度</a>来到了的<a href=""#"">大学生</a>人"
MyString=replace(MyString, "<a href=""http://www.baidu.com"">百度</a>","百度")