日期:2014-05-17 浏览次数:20365 次
public string ubbtohtml(string content) //ubb转html { content = Regex.Replace(content, @"\r\n", "<br/>"); content = Regex.Replace(content, " ", " "); content = Regex.Replace(content, @"\[b\](.+?)\[/b\]", "<b>$1</b>"); content = Regex.Replace(content, @"\[i\](.+?)\[/i\]", "<i>$1</i>"); content = Regex.Replace(content, @"\[u\](.+?)\[/u\]", "<u>$1</u>"); content = Regex.Replace(content, @"\[p\](.+?)\[/p\]", "<p class='load'>$1</p>"); content = Regex.Replace(content, @"\[align=left\](.+?)\[/align\]", "<align='left'>$1</align>"); content = Regex.Replace(content, @"\[align=center\](.+?)\[/align\]", "<align='center'>$1</align>"); content = Regex.Replace(content, @"\[align=right\](.+?)\[/align\]", "<align='right'>$1</align>"); content = Regex.Replace(content, @"\[url=(?<url>.+?)]\[/url]", "<a href='${url}' target=_blank>${url}</a>"); content = Regex.Replace(content, @"\[url=(?<url>.+?)](?<name>.+?)\[/url]", "<a href='${url}' target=_blank>${name}</a>"); content = Regex.Replace(content, @"\[quote](?<text>.+?)\[/quote]", "<div class=quote>${text}</div>"); content = Regex.Replace(content, @"\[img](?<img>.+?)\[/img]", "<img src='${img}' alt=''/>"); content = content.Replace("[face1]", "<img src='../Images/emotion/1.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face2]", "<img src='../Images/emotion/2.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face3]", "<img src='../Images/emotion/3.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face4]", "<img src='../Images/emotion/4.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face5]", "<img src='../Images/emotion/5.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face6]", "<img src='../Images/emotion/6.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face7]", "<img src='../Images/emotion/7.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face8]", "<img src='../Images/emotion/8.png' style='width:14px; height:14px;' alt='' />"); content = content.Replace("[face9]", "<img src='../Images/emotion/9.png' style='width:14px; height:14px;' alt='' />"); return content; }