最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp ubb转换代码程序
时间:2010-04-14 编辑:简简单单 来源:一聚教程网
function UBBCode(strContent,ctype) 该篇文章附带的 HTML 代码片段如下:
on error resume next
if ctype=1 then
strContent = HTMLEncode(strContent)
else
strContent = strContent
end if
dim objRegExp
Set objRegExp=new RegExp
objRegExp.IgnoreCase =true
objRegExp.Global=True
if ctype=1 then
objRegExp.Pattern="([URL])(.*?)([/URL])"
strContent= objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([URL=(.*?)])(.*?)([/URL])"
strContent= objRegExp.Replace(strContent,"$3")
objRegExp.Pattern="([EMAIL])(.*?)([/EMAIL])"
strContent= objRegExp.Replace(strContent,"$2mailto:$2"">$2>")
objRegExp.Pattern="([EMAIL=(.*?)])(.*?)([/EMAIL])"
strContent= objRegExp.Replace(strContent,"mailto:$2"" TARGET=_blank>$3")
objRegExp.Pattern="([FLASH])(.*?)([/FLASH])"
strContent= objRegExp.Replace(strContent,"")
objRegExp.Pattern="([IMG])(.*?)([/IMG])"
strContent=objRegExp.Replace(strContent,"javascript教程:if(this.width>screen.width-660)this.">")
'自动识别网址
objRegExp.Pattern = "^((http|https教程|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@[]':+!]+)"
strContent = objRegExp.Replace(strContent,"$1")
objRegExp.Pattern = "((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@[]':+!]+)$"
strContent = objRegExp.Replace(strContent,"$1")
objRegExp.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@[]':+!]+)"
strContent = objRegExp.Replace(strContent,"$1$2")
objRegExp.Pattern="([HTML])(.*?)([/HTML])"
strContent=objRegExp.Replace(strContent,"
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
")
objRegExp.Pattern="([color=(.*?)])(.*?)([/color])"
strContent=objRegExp.Replace(strContent,"$3")
objRegExp.Pattern="([face=(.*?)])(.*?)([/face])"
strContent=objRegExp.Replace(strContent,"$3")
objRegExp.Pattern="([align=(.*?)])(.*?)([/align])"
strContent=objRegExp.Replace(strContent,"
objRegExp.Pattern="([QUOTE])(.*?)([/QUOTE])"
strContent=objRegExp.Replace(strContent,"
quote:")
$2
objRegExp.Pattern="([fly])(.*?)([/fly])"
strContent=objRegExp.Replace(strContent,"")
objRegExp.Pattern="([move])(.*?)([/move])"
strContent=objRegExp.Replace(strContent,"")
objRegExp.Pattern="([glow=(.*?),(.*?),(.*?)])(.*?)([/glow])"
strContent=objRegExp.Replace(strContent,"
objRegExp.Pattern="([SHADOW=(.*?),(.*?),(.*?)])(.*?)([/SHADOW])"
strContent=objRegExp.Replace(strContent,"
objRegExp.Pattern="([i])(.*?)([/i])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([u])(.*?)([/u])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([b])(.*?)([/b])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([fly])(.*?)([/fly])"
strContent=objRegExp.Replace(strContent,"")
objRegExp.Pattern="([size=1])(.*?)([/size])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([size=2])(.*?)([/size])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([size=3])(.*?)([/size])"
strContent=objRegExp.Replace(strContent,"$2")
objRegExp.Pattern="([size=4])(.*?)([/size])"
strContent=objRegExp.Replace(strContent,"$2")
strContent = doCode(strContent, "[list]", "[/list]", "
- ", "
strContent = doCode(strContent, "[list=1]", "[/list]", "
- ", "
strContent = doCode(strContent, "[list=a]", "[/list]", "
- ", "
strContent = doCode(strContent, "[*]", "[/*]", "
strContent = doCode(strContent, "[code]", "[/code]", "
", "")
end if
if ctype=1 or ctype=2 then
objRegExp.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)](.[^[]*)(gif|jpg|jpeg|bmp|png)[/UPLOAD]"
strContent= objRegExp.Replace(strContent,"
screen.width-333)this.width=screen.width-333"">")
objRegExp.Pattern="[UPLOAD=(.[^[]*)](.[^[]*)[/UPLOAD]"
strContent= objRegExp.Replace(strContent,"
点击浏览相关文件")
end if
set objRegExp=Nothing
UBBCode=strContent
end function
-
上一个: asp判断字符串实际长度
-
下一个: 常用的asp 安全过滤函数
相关文章
- asp 通用UBB代码转换程序 07-06
- VBS 批量Ping的项目讲解 09-19
- 如何封装一个Ajax函数介绍 09-16
- ASP实现加法验证码方法 09-16
- ASP错误捕获的几种常规处理方法介绍 09-16
- ajax实现城市三级联动的代码介绍 09-16