首页 > 开发 > HTML > 正文

ASP:去掉字符串中的超连接

2020-02-10 17:19:35
字体:
来源:转载
供稿:网友
<p><a href='1.html'>11111</a></p><p>2222</p> 
<p><a href='2.html'>3333</a></p><p>44444</p> 
想得到的结果是: 
<p>11111</p><p>2222</p><p>3333</p><p>4444</p> 

<%
Function regExReplace(sSource,patrn, replStr) 
Dim regEx, str1 
str1 = sSource 
Set regEx = New RegExp 
regEx.Pattern = patrn 
regEx.IgnoreCase = True 
regEx.Global = True 
regExReplace = regEx.Replace(str1, replStr) 
End Function 

dim c1,c2 
c1="<p><a href='1.html'>11111</a></p><p>2222</p> 
<p><a href='2.html'>3333</a></p><p>44444</p> " 
c2=regExReplace(c1,"<a.*?>|</a>","")
response.Write(c2) 
%>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表