⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ubb.asp

📁 一个有用的东西 希望大家喜欢 谢谢大家对本站的支持
💻 ASP
字号:
<%
'以下部分代码来自动网BBS的ubb.asp文件
function UBBCode(strContent)
	
	dim re,i
	UbbCode=strContent
	if (instr(strContent,"[")=0 or instr(strContent,"]")=0) and instr(strContent,"http://")=0 then
		exit function
	end if
	
	Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True
	

	
	
	if instr(1,strContent,"[IMG]",1)>0 then
		re.Pattern="(\[IMG\])(.[^\[]*)(\[\/IMG\])"
			strContent=re.Replace(strContent,"<a href=""$2"" target=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>400)this.width=400""></a> ")
	end if
	
	if instr(1,strContent,"[/url]",1)>0 then
		re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
		strContent= re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank>$2</A>")
		re.Pattern="(\[URL=(.[^\]]*)\])(.[^\[]*)(\[\/URL\])"
		strContent= re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank>$3</A>")
	end if
	
	if instr(1,strContent,"[/email]",1)>0 then
		re.Pattern="(\[EMAIL\])(.[^\[]*)(\[\/EMAIL\])"
		strContent= re.Replace(strContent,"<A HREF=""mailto:$2"">$2</A>")
		re.Pattern="(\[EMAIL=(.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
		strContent= re.Replace(strContent,"<A HREF=""mailto:$2"">$3</A>")
	end if
	
	if instr(1,strContent,"http://",1)>0 then
		re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		
		re.Pattern = "([^>=""])(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"$1<a target=_blank href=$2>$2</a>")
	end if
	
	if instr(1,strContent,"ftp://",1)>0 then
		re.Pattern = "^(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "([^>=""])(ftp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"$1<a target=_blank href=$2>$2</a>")
	end if
	
	if instr(1,strContent,"rtsp://",1)>0 then
		re.Pattern = "^(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "([^>=""])(rtsp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"$1<a target=_blank href=$2>$2</a>")
	end if
	
	if instr(1,strContent,"mms://",1)>0 then
		re.Pattern = "^(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
		strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
		re.Pattern = "([^>=""])(mms://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
		strContent = re.Replace(strContent,"$1<a target=_blank href=$2>$2</a>")
	end if

	if instr(1,strContent,"[/color]",1)>0 then
		re.Pattern="(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])"
		strContent=re.Replace(strContent,"<font color=$2>$3</font>")
	end if
	if instr(1,strContent,"[/align]",1)>0 then
		re.Pattern="(\[align=(.[^\[]*)\])(.[^\[]*)(\[\/align\])"
		strContent=re.Replace(strContent,"<div align=$2>$3</div>")
	end if
	if instr(1,strContent,"[/b]",1)>0 then
		re.Pattern="(\[b\])(.[^\[]*)(\[\/b\])"
		strContent=re.Replace(strContent,"<b>$2</b>")
	end if
	set re=Nothing
	UBBCode=strContent
end function
'结束
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -