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

最新下载

热门教程

实现网址的自动识别

时间:2022-07-02 12:08:25 编辑:袖梨 来源:一聚教程网

public static string Auto(string str)
//========================//
// www.
// http://
// ftp://
// [email protected]
// 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./=?%-&_~`@':+!]+)");

热门栏目