一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

实现网址的自动识别

时间:2008-01-12 编辑:简简单单 来源:一聚教程网

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$2");
Reg = new Regex("^(http://[A-Za-z0-9./=?%-&_~`@':+!]+)");
str = Reg.Replace(str,"$1");
Reg = new Regex("(http://[A-Za-z0-9./=?%-&_~`@':+!]+)$");
str = Reg.Replace(str,"$1");
Reg = new Regex("([^]=>])(ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)");
str = Reg.Replace(str,"$1$2");
Reg = new Regex("^(ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)");
str = Reg.Replace(str,"$1");
Reg = new Regex("(ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)$");
str = Reg.Replace(str,"$1");
Reg = new Regex("([^]=>])(mms://[A-Za-z0-9./=?%-&_~`@':+!]+)");
str = Reg.Replace(str,"$1$2");
Reg = new Regex("^(mms://[A-Za-z0-9./=?%-&_~`@':+!]+)");

热门栏目