就是在论坛输入文章的时候,怎样把文章里带http的,和带邮件标志@的自动变成超文本连接?
可以用C#和asp.net实现吗?
可以用SQL 的XML生成。
一个简单的用正则表达式给http加连接的函数,不完善,还需要改进
public static string urlp(string Str)
{
Regex myre = new Regex(@"http://\S+", RegexOptions.IgnoreCase); MatchCollection mclist = myre.Matches(Str);
foreach (Match m in mclist)
{
Str = Str.Replace(m.Value,"<a href=\"" + m.Value + "\"> "+m.Value+"</a>");
}
return Str;
}
Regex my=new Regex(@"[^>=""](HTTP://[A-Za-z0-9\./=\?%\-&_~`@:+!]+)",RegexOptions.IgnoreCase);
str = my.Replace(str,@"<a target=_blank href=$1>$1</a>");