using System; using System.Text; using System.Text.RegularExpressions; namespace Test.Com { /// <summary> /// 功能:UBB代碼 /// 作者:Rexsp /// 日期:2004-4-6 /// </s " /> 亚洲欧美国产综合在线,又色又爽又黄gif动态视频,久久久久琪琪精品色

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

asp.net ubb使用代碼

復制代碼 代碼如下:
////別人寫的ubb代碼

using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Test.Com
{
/// <summary>
/// 功能:UBB代碼
/// 作者:Rexsp
/// 日期:2004-4-6
/// </summary>
public class UBB
{
#region 構造函數
public UBB()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
#endregion
#region 公共靜態方法
/// <summary>
/// UBB代碼處理函數
/// </summary>
/// <param name="sDetail">輸入字符串</param>
/// <returns>輸出字符串</returns>
public static string UBBToHTML(string sDetail)
{
Regex r;
Match m;
#region 處理空格
sDetail = sDetail.Replace(" "," ");
#endregion
#region html標記符
sDetail = sDetail.Replace("<","<");
sDetail = sDetail.Replace(">",">");
#endregion
#region 處[b][/b]標記
r = new Regex(@"(/[b/])([ /S/t]*?)(/[//b/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<B>" + m.Groups[2].ToString() + "</B>");
}
#endregion
#region 處[i][/i]標記
r = new Regex(@"(/[i/])([ /S/t]*?)(/[//i/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<I>" + m.Groups[2].ToString() + "</I>");
}
#endregion
#region 處[u][/u]標記
r = new Regex(@"(/[U/])([ /S/t]*?)(/[//U/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<U>" + m.Groups[2].ToString() + "</U>");
}
#endregion
#region 處[p][/p]標記
//處[p][/p]標記
r = new Regex(@"((/r/n)*/[p/])(.*?)((/r/n)*/[//p/])",RegexOptions.IgnoreCase|RegexOptions.Singleline);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<P class=/"pstyle/">" + m.Groups[3].ToString() + "</P>");
}
#endregion
#region 處[sup][/sup]標記
//處[sup][/sup]標記
r = new Regex(@"(/[sup/])([ /S/t]*?)(/[//sup/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<SUP>" + m.Groups[2].ToString() + "</SUP>");
}
#endregion
#region 處[sub][/sub]標記
//處[sub][/sub]標記
r = new Regex(@"(/[sub/])([ /S/t]*?)(/[//sub/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<SUB>" + m.Groups[2].ToString() + "</SUB>");
}
#endregion
#region 處[url][/url]標記
//處[url][/url]標記
r = new Regex(@"(/[url/])([ /S/t]*?)(/[//url/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=/"" + m.Groups[2].ToString() + "/" target=/"_blank/"><IMG border=0 src=/"images/url.gif/">" +
m.Groups[2].ToString() + "</A>");
}
#endregion
#region 處[url=xxx][/url]標記
//處[url=xxx][/url]標記
r = new Regex(@"(/[url=([ /S/t]+)/])([ /S/t]*?)(/[//url/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=/"" + m.Groups[2].ToString() + "/" target=/"_blank/"><IMG border=0 src=/"images/url.gif/">" +
m.Groups[3].ToString() + "</A>");
}
#endregion
#region 處[email][/email]標記
//處[email][/email]標記
r = new Regex(@"(/[email/])([ /S/t]*?)(/[//email/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=/"mailto:" + m.Groups[2].ToString() + "/" target=/"_blank/"><IMG border=0 src=/"images/email.gif/">" +
m.Groups[2].ToString() + "</A>");
}
#endregion
#region 處[email=xxx][/email]標記
//處[email=xxx][/email]標記
r = new Regex(@"(/[email=([ /S/t]+)/])([ /S/t]*?)(/[//email/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=/"mailto:" + m.Groups[2].ToString() + "/" target=/"_blank/"><IMG border=0 src=/"images/email.gif/">" +
m.Groups[3].ToString() + "</A>");
}
#endregion
#region 處[size=x][/size]標記
//處[size=x][/size]標記
r = new Regex(@"(/[size=([1-7])/])([ /S/t]*?)(/[//size/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT SIZE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處[color=x][/color]標記
//處[color=x][/color]標記
r = new Regex(@"(/[color=([/S]+)/])([ /S/t]*?)(/[//color/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT COLOR=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處[font=x][/font]標記
//處[font=x][/font]標記
r = new Regex(@"(/[font=([/S]+)/])([ /S/t]*?)(/[//font/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT FACE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處理圖片鏈接
//處理圖片鏈接
r = new Regex("http://[picture//](//d+?)//[///picture//]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=/"ShowImage.ASPx?Type=ALL&Action=forumImage&ImageID=" + m.Groups[1].ToString() +
"/" target=/"_blank/"><IMG border=0 Title=/"點擊打開新窗口查看/" src=/"ShowImage.ASPx?Action=forumImage&ImageID=" + m.Groups[1].ToString() +
"/"></A>");
}
#endregion
#region 處理[align=x][/align]
//處理[align=x][/align]
r = new Regex(@"(/[align=([/S]+)/])([ /S/t]*?)(/[//align/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<P align=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</P>");
}
#endregion
#region 處[H=x][/H]標記
//處[H=x][/H]標記
r = new Regex(@"(/[H=([1-6])/])([ /S/t]*?)(/[//H/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<H" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</H" + m.Groups[2].ToString() + ">");
}
#endregion
#region 處理[list=x][*][/list]
//處理[list=x][*][/list]
r = new Regex(@"(/[list(=(A|a|I|i| ))?/]([ /S/t]*)/r/n)((/[/*/]([ /S/t]*/r/n))*?)(/[//list/])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
string strLI = m.Groups[5].ToString();
Regex rLI = new Regex(@"/[/*/]([ /S/t]*/r/n?)",RegexOptions.IgnoreCase);
Match mLI;
for (mLI = rLI.Match(strLI); mLI.Success; mLI = mLI.NextMatch())
{
strLI = strLI.Replace(mLI.Groups[0].ToString(),"<LI>" + mLI.Groups[1]);
}
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<UL TYPE=/"" + m.Groups[3].ToString() + "/"><B>" + m.Groups[4].ToString() + "</B>" +
strLI + "</UL>");
}
#endregion
#region 處理換行
//處理換行,在每個新行的前面添加兩個全角空格
r = new Regex(@"(/r/n(( )| )+)(?<正文>/S+)",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<BR>  " + m.Groups["正文"].ToString());
}
//處理換行,在每個新行的前面添加兩個全角空格
sDetail = sDetail.Replace("/r/n","<BR>");
#endregion
return sDetail;
}
#endregion
}
}


ASP.NET(c#) ubb處理類
http://www.jb51.NET/article/15615.htm

AspNet技術asp.net ubb使用代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 暖暖 日本 视频 在线观看免费 | 欧美日韩精品不卡在线观看 | 四房播播最新地址 | 亚洲 日韩 自拍 视频一区 | 欧美男女爱爱 | 综合激情区视频一区视频二区 | 亚洲第一成年人网站 | 国产 亚洲 日韩 欧美 在线观看 | 久久精品无码一区二区日韩av | 国内国外精品影片无人区 | 动漫美女被爆挤奶歪歪漫画 | 亚洲 日本 天堂 国产 在线 | 美女网站免费久久久久久久 | 国产精品18久久久久网站 | 女人高潮被爽到呻吟在线观看 | 亚洲国产中文字幕在线视频综合 | 日本少妇无码精品12P | 国产一区日韩二区欧美三区 | 狠狠色狠狠色综合日日2019 | 三级网站视频在线观看 | 国产99r视频精品免费观看 | 51精品国产AV无码久久久密桃 | 男生插曲女生身全过程 | 四虎视频最新视频在线观看 | 一区二区乱子伦在线播放 | 果冻传媒APP免费网站在线观看 | 国产传媒麻豆剧精品AV | 翁熄性放纵交换300章 | 黑人阴茎插女人图片 | 亚洲欧美一级久久精品 | 在线观看成年人免费视频 | 亚洲国产女人aaa毛片在线 | www.av一区 | 超碰免费视频caoporn | 免费在线视频一区 | 啊灬啊别停灬用力啊在线观看视频 | 第一次破女视频出血视频 | 97免费人妻在线观看 | 国产免费人视频在线观看免费 | 亚洲精品福利在线 | 青草在线在线d青草在线 |