内容显示页
 
类别:ASP+VBS | 浏览(181) | 2006-8-9 8:04:00

asp,将变量中内容中的http地址自动加上连接
<%
strContent ="老大,给我加个链接吧http://www.yongfa365.com哈哈哈哈,这是我家娘子的网址:http://hi.baidu.com/chenmanxia,好了,加链接吧"
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
re.Pattern = "[^>=""](http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")

response.Write(strContent)
%>

可修改代码后再运行

 


引用本页地址:http://www.yongfa365.com/item/69f3787eca1ab30b.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
专题(3)
 
.Net + C#(41)
 
ASP+VBS(153)
 
 
 
Linux(10)
 
 
 
web 2.0(24)
 
 
 
 
 
心程(59)
 
生活(80)
 
 
     

Power by :柳永法(yongfa365)'Blog | Model by :hibaidu | CSS by:众网友 | 京ICP备07011491号  QQ:64049027  E-mail:64049027qq.com

本空间赞助商:北京中科兴联信息技术有限公司