Very nice one UBB code _asp basics

Source: Internet
Author: User
<%
Function HTMLEncode (ByVal strvalue)
' Ignore errors
On Error Resume Next
' Define variables
Dim Strnewvalue
If strvalue <> "" Then
Strnewvalue = Replace (strvalue, "<", "<")
Strnewvalue = Replace (Strnewvalue, ">", ">")
Strnewvalue = Replace (Strnewvalue, "'", "")
Strnewvalue = Replace (Strnewvalue, "" "", "" ")
Strnewvalue = Replace (Strnewvalue,vbcrlf, "<br>")
Strnewvalue = Replace (Strnewvalue, "", "")
End If
HTMLEncode = Strnewvalue
' Output error
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, "<a href=" "$" "Target=_blank>screen.width-333) this.width=screen.width-333 "></a>")

Regexp.pattern= "(\[flash\]) (. [ ^\[]*) (\[\/flash\]) "
Strvalue=regexp.replace (strvalue, "<object codebase=" Http://download.macromedia.com/pub/sho ... h/swflash.cab# version=4,0,2,0 "" "classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 height=400 id=ShockwaveFlash1> <param Name=movie value= "" $ "" ><param name=quality value=high><embed src= "" $ "" Quality=high Pluginspage= """) ' Target=_blank rel=nofollow>http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash "" type= "" Appl ... Height=400></embed></object> ")

Regexp.pattern= "(\[zip\]) (. [ ^\[]*) (\[\/zip\]) "
Strvalue=regexp.replace (strvalue, "<br><a href=" "$" "> click to download the file </a>")

Regexp.pattern= "(\[rar\]) (. [ ^\[]*) (\[\/rar\]) "
Strvalue=regexp.replace (strvalue, "<br><a href=" "$" "> click to download the file </a>")

' Regexp.pattern= ' (\[upload= (. [ ^\[]*)\])(. [^\[]*) (\[\/upload\]) "
' Strvalue=regexp.replace (strvalue, "<br> <a HREF=" "$" "TARGET=_blank > Click to view or download the file </A> ")
' Strvalue=regexp.replace (strvalue, "<br><a HREF= "" $ "target=_blank> screen.width-333) this.width=screen.width-333 "></A>")

Regexp.pattern= "(\[url\]) (http:\/\/.[ ^\[]*) (\[\/url\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "$" "target=_blank>$2</a>")

Regexp.pattern= "(\[url\]) (. [ ^\[]*) (\[\/url\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "$") ' Target=_blank rel=nofollow>http://$2 ' "target= ... t;/A>" )

Regexp.pattern= "(\*) \]) (. [ ^\[]*) (\[\/url\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "$" "target=_blank>$3</a>")

Regexp.pattern= "(\[url= (. [ ^\[]*)\])(. [^\[]*) (\[\/url\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "[url]http://$2" "target=_blank>$3</a>")

Regexp.pattern= "(\[email\]) (\s+\@.[ ^\[]*) (\[\/email\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "mailto:$2" ">$2</A>")

Regexp.pattern= "(\[email= (\s+\@.[ ^\[]*)\])(. [^\[]*) (\[\/email\]) "
Strvalue=regexp.replace (strvalue, "<a href=" "mailto:$2" "target=_blank>$3</a>")

Regexp.pattern = "^" (http://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "(http://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)$"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "[^>="] (http://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "^" (ftp://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "(ftp://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)$"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "[^>="] (ftp://[a-za-z0-9\.\/=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "^" (rtsp://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "(rtsp://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)$"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "[^>="] (rtsp://[a-za-z0-9\.\/=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "^" (mms://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "(mms://[a-za-z0-9\./=\?%\ -&_~ ' @ ': +!] +)$"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern = "[^>="] (mms://[a-za-z0-9\.\/=\?%\ -&_~ ' @ ': +!] +)"
Strvalue=regexp.replace (strvalue, "<a target=_blank href=$1>$1</a>")

Regexp.pattern= "(\[html\]) (. [ ^\[]*) (\[\/html\]) "
Strvalue=regexp.replace (strvalue, "<table width= ' 100% ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 6 ' bgcolor= ') FFFFFF ' ><td><b> below for program code:</b><br>$2</td></table> ')

Regexp.pattern= "(\[code\]) (. [ ^\[]*) (\[\/code\]) "
Strvalue=regexp.replace (strvalue, "<table width= ' 100% ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 6 ' bgcolor= ') FFFFFF ' ><td><b> below for program code:</b><br>$2</td></table> ')

Regexp.pattern= "(\[color= (. [ ^\[]*)\])(. [^\[]*) (\[\/color\]) "
Strvalue=regexp.replace (strvalue, "<font color=$2>$3</font>")

Regexp.pattern= "(\[face= (. [ ^\[]*)\])(. [^\[]*) (\[\/face\]) "
Strvalue=regexp.replace (strvalue, "<font face=$2>$3</font>")

Regexp.pattern= "(\[align= (. [ ^\[]*) \]) (. *) (\[\/align\]) "
Strvalue=regexp.replace (strvalue, "<div align=$2>$3</div>")

Regexp.pattern= "(\[quote\]) (. *) (\[\/quote\])"
Strvalue=regexp.replace (strvalue, "<table cellpadding=0 cellspacing=0 border=0 width=94% bgcolor= #000000 align= Center><tr><td><table width=100% cellpadding=5 cellspacing=1 Border=0><TR><TD BGCOLOR = ' #FFFFFF ' >$2</table></table><br> ')

Regexp.pattern= "(\[fly\]) (. *) (\[\/fly\])"
Strvalue=regexp.replace (strvalue, "<marquee width=90% behavior=alternate scrollamount=3>$2</marquee>")

Regexp.pattern= "(\[move\]) (. *) (\[\/move\])"
Strvalue=regexp.replace (strvalue, "<marquee scrollamount=3>$2</marquee>")

Regexp.pattern= "\[glow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*) \] (. [ ^\[]*) \[\/glow] "
Strvalue=regexp.replace (strvalue, "<table width=$1 style=" "Filter:glow (color=$2, strength=$3)" ">$4</table > ")

Regexp.pattern= "\[shadow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*) \] (. [ ^\[]*) \[\/shadow] "
Strvalue=regexp.replace (strvalue, "<table width=$1 style=" "Filter:shadow (color=$2, strength=$3)" ">$4</ Table> ")

Regexp.pattern= "(\[i\]) (. [ ^\[]*) (\[\/i\]) "
Strvalue=regexp.replace (strvalue, "<i>$2</i>")

Regexp.pattern= "(\[u\]) (. [ ^\[]*) (\[\/u\]) "
Strvalue=regexp.replace (strvalue, "<u>$2</u>")

Regexp.pattern= "(\[b\]) (. [ ^\[]*) (\[\/b\]) "
Strvalue=regexp.replace (strvalue, "<b>$2</b>")

Regexp.pattern= "(\[fly\]) (. [ ^\[]*) (\[\/fly\]) "
Strvalue=regexp.replace (strvalue, "<marquee>$2</marquee>")

Regexp.pattern= "(\[size=1\]) (. [ ^\[]*) (\[\/size\]) "
Strvalue=regexp.replace (strvalue, "<font size=1>$2</font>")

Regexp.pattern= "(\[size=2\]) (. [ ^\[]*) (\[\/size\]) "
Strvalue=regexp.replace (strvalue, "<font size=2>$2</font>")

Regexp.pattern= "(\[size=3\]) (. [ ^\[]*) (\[\/size\]) "
Strvalue=regexp.replace (strvalue, "<font size=3>$2</font>")

Regexp.pattern= "(\[size=4\]) (. [ ^\[]*) (\[\/size\]) "
Strvalue=regexp.replace (strvalue, "<font size=4>$2</font>")

Regexp.pattern= "(\[center\]) (. [ ^\[]*) (\[\/center\]) "
Strvalue=regexp.replace (strvalue, "<center>$2</center>")
End If
Set regexp=nothing
Ubbcode=strvalue

' Output error
If err.number>0 Then
Response.Write Err.Description
Response.End
End If
End Function
%>

Call: <%=ubbcode (Content)%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.