当前位置: 首页 > 图文教程 > 网络编程 > ASP > 如何使用asp去字符串中的超链接

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

ASP 中的 如何使用asp去字符串中的超链接


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 123 ::
收藏到网摘: n/a

下面是一个去掉超链接的例子,改变一下,可以去掉其他的,如script、div、span等html代码


<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) 
%>