UBB代码
来源:爱站网时间:2020-10-09编辑:网友分享
你知道什么是UBB代码,UBB代码是一种特殊的TAG,功能很少,但是由于其Tag语法检查实现非常容易,因此很多人都会引用这种代码,那么下面就让小编为大家介绍一种不错的UBB代码。
你知道什么是UBB代码,UBB代码是一种特殊的TAG,功能很少,但是由于其Tag语法检查实现非常容易,因此很多人都会引用这种代码,那么下面就让小编为大家介绍一种不错的UBB代码。
Function HTMLEncode(ByVal strValue)
'忽略错误
On Error Resume Next
'定义变量
Dim strNewValue
If strValue "" Then
strNewValue = Replace(strValue," strNewValue = Replace(strNewValue,">",">")
strNewValue = Replace(strNewValue,"'","'")
strNewValue = Replace(strNewValue,"""",""")
strNewValue = Replace(strNewValue,vbCrLf,"
")
strNewValue = Replace(strNewValue," "," ")
End If
HTMLEncode = strNewValue
'输出错误
If Err.Number>0 Then
Response.Write Err.Description
Response.End
End If
End Function
Function UBBCode(strValue)
Dim RegExp
'strValue=HTMLEncode(strValue)
Set RegExp=New RegExp
RegExp.IgnoreCase =True
RegExp.Global=True
If strValue "" Then
RegExp.Pattern="(\[IMG\])(.[^\[]*)(\[\/IMG\])"
strValue=RegExp.Replace(strValue,"screen.width-333)this.width=screen.width-333"">")
RegExp.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[ZIP\])(.[^\[]*)(\[\/ZIP\])"
strValue=RegExp.Replace(strValue,"
点击下载该文件")
RegExp.Pattern="(\[RAR\])(.[^\[]*)(\[\/RAR\])"
strValue=RegExp.Replace(strValue,"
点击下载该文件")
'RegExp.Pattern="(\[UPLOAD=(.[^\[]*)\])(.[^\[]*)(\[\/UPLOAD\])"
'strValue=RegExp.Replace(strValue,"
点击查看或下载该文件")
'strValue=RegExp.Replace(strValue,"
此主题相关图片如下:
screen.width-333)this.width=screen.width-333"">")
RegExp.Pattern="(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"http://$2"" TARGET= ... t;/A>")
RegExp.Pattern="(\*)\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[EMAIL=(\S+\@.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](ftp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](rtsp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](mms://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern="(\[HTML\])(.[^\[]*)(\[\/HTML\])"
strValue=RegExp.Replace(strValue,"
")
RegExp.Pattern="(\[code\])(.[^\[]*)(\[\/code\])"
strValue=RegExp.Replace(strValue,"
")
RegExp.Pattern="(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[face=(.[^\[]*)\])(.[^\[]*)(\[\/face\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[align=(.[^\[]*)\])(.*)(\[\/align\])"
strValue=RegExp.Replace(strValue,"
RegExp.Pattern="(\[QUOTE\])(.*)(\[\/QUOTE\])"
strValue=RegExp.Replace(strValue,"
")
RegExp.Pattern="(\[fly\])(.*)(\[\/fly\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[move\])(.*)(\[\/move\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/GLOW]"
strValue=RegExp.Replace(strValue,"$4
")
RegExp.Pattern="\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/SHADOW]"
strValue=RegExp.Replace(strValue,"$4
")
RegExp.Pattern="(\[i\])(.[^\[]*)(\[\/i\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[u\])(.[^\[]*)(\[\/u\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[b\])(.[^\[]*)(\[\/b\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[fly\])(.[^\[]*)(\[\/fly\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[size=1\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=2\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=3\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=4\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[center\])(.[^\[]*)(\[\/center\])"
strValue=RegExp.Replace(strValue,"$2 ")
End If
Set RegExp=Nothing
UBBCode=strValue
'输出错误
If Err.Number>0 Then
Response.Write Err.Description
Response.End
End If
End Function
%>
'忽略错误
On Error Resume Next
'定义变量
Dim strNewValue
If strValue "" Then
strNewValue = Replace(strValue," strNewValue = Replace(strNewValue,">",">")
strNewValue = Replace(strNewValue,"'","'")
strNewValue = Replace(strNewValue,"""",""")
strNewValue = Replace(strNewValue,vbCrLf,"
")
strNewValue = Replace(strNewValue," "," ")
End If
HTMLEncode = strNewValue
'输出错误
If Err.Number>0 Then
Response.Write Err.Description
Response.End
End If
End Function
Function UBBCode(strValue)
Dim RegExp
'strValue=HTMLEncode(strValue)
Set RegExp=New RegExp
RegExp.IgnoreCase =True
RegExp.Global=True
If strValue "" Then
RegExp.Pattern="(\[IMG\])(.[^\[]*)(\[\/IMG\])"
strValue=RegExp.Replace(strValue,"screen.width-333)this.width=screen.width-333"">")
RegExp.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[ZIP\])(.[^\[]*)(\[\/ZIP\])"
strValue=RegExp.Replace(strValue,"
点击下载该文件")
RegExp.Pattern="(\[RAR\])(.[^\[]*)(\[\/RAR\])"
strValue=RegExp.Replace(strValue,"
点击下载该文件")
'RegExp.Pattern="(\[UPLOAD=(.[^\[]*)\])(.[^\[]*)(\[\/UPLOAD\])"
'strValue=RegExp.Replace(strValue,"
点击查看或下载该文件")
'strValue=RegExp.Replace(strValue,"
此主题相关图片如下:
screen.width-333)this.width=screen.width-333"">")
RegExp.Pattern="(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"http://$2"" TARGET= ... t;/A>")
RegExp.Pattern="(\*)\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[EMAIL=(\S+\@.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](ftp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](rtsp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "^(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern = "[^>=""](mms://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"$1")
RegExp.Pattern="(\[HTML\])(.[^\[]*)(\[\/HTML\])"
strValue=RegExp.Replace(strValue,"
以下内容为程序代码: $2 |
RegExp.Pattern="(\[code\])(.[^\[]*)(\[\/code\])"
strValue=RegExp.Replace(strValue,"
以下内容为程序代码: $2 |
RegExp.Pattern="(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[face=(.[^\[]*)\])(.[^\[]*)(\[\/face\])"
strValue=RegExp.Replace(strValue,"$3")
RegExp.Pattern="(\[align=(.[^\[]*)\])(.*)(\[\/align\])"
strValue=RegExp.Replace(strValue,"
$3
") RegExp.Pattern="(\[QUOTE\])(.*)(\[\/QUOTE\])"
strValue=RegExp.Replace(strValue,"
|
")
RegExp.Pattern="(\[fly\])(.*)(\[\/fly\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[move\])(.*)(\[\/move\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/GLOW]"
strValue=RegExp.Replace(strValue,"
RegExp.Pattern="\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/SHADOW]"
strValue=RegExp.Replace(strValue,"
RegExp.Pattern="(\[i\])(.[^\[]*)(\[\/i\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[u\])(.[^\[]*)(\[\/u\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[b\])(.[^\[]*)(\[\/b\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[fly\])(.[^\[]*)(\[\/fly\])"
strValue=RegExp.Replace(strValue,"")
RegExp.Pattern="(\[size=1\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=2\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=3\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[size=4\])(.[^\[]*)(\[\/size\])"
strValue=RegExp.Replace(strValue,"$2")
RegExp.Pattern="(\[center\])(.[^\[]*)(\[\/center\])"
strValue=RegExp.Replace(strValue,"
End If
Set RegExp=Nothing
UBBCode=strValue
'输出错误
If Err.Number>0 Then
Response.Write Err.Description
Response.End
End If
End Function
%>
调用:
上文就是小编介绍的UBB代码,大家在使用的过程中有任何不懂的地方都可以在下方给小编留言询问喔!
下一篇:实用的20例ASP编程