可以用字符串类的截取 string aa = "详情请参考http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=e2798a59-79d5-4833-9c57-87d46a8b907a这个网址"; aa = aa.Substring(aa.IndexOf("http://"));
Regex reg = new Regex(@"((http|https|ftp):(\/\/|\\\\)){0,}((\w)+[.]{1,}([\~]*))(.*[\x00-\xff])")改写了bdmh 的正则表达式,实现了,输入www.baidu.com 也可以显示连接,谢谢大家的热情帮助!谢谢
Regex.IsMatch(text, @"((http|https|ftp):(\/\/|\\\\)((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)*(((([?](\w)+){1}[=]*))*((\w)+){1}([\&](\w)+[\=](\w)+)*)*)", RegexOptions.IgnoreCase)这个可以判断里面是否包含网址,但是怎么去他的位置以及确认最后由汉字断开的呢?具体代码应该怎么写?
我用这个取出来了,但是这个正则表达式只是用于http://,那如果是https://或者ftp:// 或者直接是www
应该怎么写正则表达式呢?我对正则不是很了解,那位高手写下
string aa = "详情请参考http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=e2798a59-79d5-4833-9c57-87d46a8b907a这个网址";
aa = aa.Substring(aa.IndexOf("http://"));