当前位置: 网学 > 编程文档 > ASP > 正文

很不错的一个UBB代码

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/17

鉴于大家对ASP十分关注,我们编辑小组在此为大家搜集整理了“很不错的一个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,"<br>")
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,"<a href=""$2"" target=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>")

RegExp.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])"
strValue=RegExp.Replace(strValue,"<OBJECT codebase=""/uploadfile/201306/17/3C155337928.gif"" border=0> <A HREF=""$3"" TARGET=_blank>点击查看或下载该文件</A>")
''strValue=RegExp.Replace(strValue,"<br><IMG SRC=""/uploadfile/201306/17/1B155338864.gif"" border=0>此主题相关图片如下:<br><A HREF=""$3"" TARGET=_blank><IMG SRC=""$3"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")

RegExp.Pattern="(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"<A HREF=""$2"" TARGET=_blank>$2</A>")

RegExp.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"<A HREF=""$2") '' target=_blank rel=nofollow>http://$2"" TARGET= ... t;/A>")

RegExp.Pattern="(\*)\])(.[^\[]*)(\[\/URL\])"
strValue=RegExp.Replace(strValue,"<A HREF=""$2"" 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.P
  • 下一篇资讯: ASP充分利用Err.Description
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号