·您的位置: 首页 » 资源教程 » 编程开发 » ASP » ASP实现网址的自动识别

ASP实现网址的自动识别

类别: ASP教程  评论数:0 总得分:0
public static string Auto(string str)

//========================//

// www.

// http://

// ftp://

// xx@xx.xx

// mms://

//========================//

{

Reg = new Regex("([^\\]=>])(http://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"$1<a href="$2" target="_blank">$2</a>");

Reg = new Regex("^(http://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("(http://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)$");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("([^\\]=>])(ftp://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"$1<a href="$2" target="_blank">$2</a>");

Reg = new Regex("^(ftp://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("(ftp://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)$");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("([^\\]=>])(mms://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"$1<a href="$2" target="_blank">$2</a>");

Reg = new Regex("^(mms://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("(mms://[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)$");

str = Reg.Replace(str,"<a href="$1" target="_blank">$1</a>");

Reg = new Regex("([a-z0-9_A-Z\\-\\.]{1,20})@([a-z0-9_\\-]{1,15})\\.([a-z]{2,4})");

str = Reg.Replace(str,"<a href="mailto:$1@$2.$3" target="_blank">$1@$2.$3</a>");

Reg = new Regex("([^/])(www.[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"$1<a href="http://$2" target="_blank">$2</a>");

Reg = new Regex("^(www.[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)");

str = Reg.Replace(str,"<a href="http://$1" target="_blank">$1</a>");

Reg = new Regex("(www.[A-Za-z0-9\\./=\\?%\\-&_~`@’’:+!]+)$");

str = Reg.Replace(str,"<a href="http://$1" target="_blank">$1</a>");

return str;

}
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1