建议置顶
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^UBB代码开始^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
function UBBCode(strContent)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
'^^^^^^^^^^^^^^^^^^^^^给网址自动加上链接^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.pattern="((http|https|ftp):(\/\/|\\\\)((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)*(((([?](\w)+){1}[=]*))*((\w)+){1}([\&](\w)+[\=](\w)+)*)*)"
strcontent=re.replace(strcontent,"
$1")
'^^^^^^^^^^^^^^^^^^^^^^图片正则匹配^^^^^^^^^^^^^^^^^
re.Pattern="(\[IMG\])(.[^\]]*)(\[\/IMG\])"
strContent=re.Replace(strContent,"
")
'^^^^^^^^^^^^^^^^^^^^^^^把图片中的网址加上自动链接的再次转换过来^^^^^^^^^^^^^^^
re.pattern="(\
)(.[^\]]*)(\<\/A\>\>)"
strcontent=re.replace(strContent,"
")
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.Pattern="(\[FLASH\])(.[^\]]*)(\[\/FLASH\])"
strContent= re.Replace(strContent,"
")
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^地址链接正则匹配^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.Pattern="(\[URL\])(http:\/\/.[^\]]*)(\[\/URL\])"
strContent= re.Replace(strContent,"
$2")
re.Pattern="(\[URL\])(.[^\]]*)(\[\/URL\])"
strContent= re.Replace(strContent,"
$2")
re.Pattern="(\[URL=(http:\/\/.[^\]]*)\])(.[^\]]*)(\[\/URL\])"
strContent= re.Replace(strContent,"
$3")
re.Pattern="(\[URL=(.[^\]]*)\])(.[^\]]*)(\[\/URL\])"
strContent= re.Replace(strContent,"
$3")
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Email正则匹配^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.Pattern="(\[EMAIL\])(.[^\]]*)(\[\/EMAIL\])"
strContent= re.Replace(strContent,"
$2")
re.Pattern="(\[EMAIL=(.[^\]]*)\])(.[^\]]*)(\[\/EMAIL\])"
strContent= re.Replace(strContent,"
$3")
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^回复引用正则匹配^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.Pattern="(\[QUOTE\])(.[^\]]*)(\[\/QUOTE\])"
'strContent=re.Replace(strContent,"
引用:
$2
")
replstr="
引用:
$2
"
Set Matches=re.Execute(strContent) '执行搜索
for each Match in matches
strcontent = re.Replace(strContent, replStr)
strcontent = re.Replace(strcontent, replStr)
next
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^字体正则匹配^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
re.Pattern="(\[fly\])(.*)(\[\/fly\])"
strContent=re.Replace(strContent,"
")
re.Pattern="(\[move\])(.*)(\[\/move\])"
strContent=re.Replace(strContent,"
")
re.Pattern="\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\]]*)\[\/GLOW]"
strContent=re.Replace(strContent,"
")
re.Pattern="\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\]]*)\[\/SHADOW]"
strContent=re.Replace(strContent,"
")
re.Pattern="(\[face=(.[^\]]*)\])(.*)(\[\/face\])"
strContent=re.Replace(strContent,"
$3")
re.Pattern="(\[i\])(.[^\]]*)(\[\/i\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[u\])(.[^\]]*)(\[\/u\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[b\])(.[^\]]*)(\[\/b\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="\[align=(.[^\]]*)\](.*)\[\/align\]"
strContent=re.Replace(strContent,"
$2
")
re.Pattern="\[color=(.[^\]]*)\](.[^\[]*)\[\/color\]"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[size=1\])(.[^\[]*)(\[\/size\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[size=2\])(.[^\[]*)(\[\/size\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[size=3\])(.[^\[]*)(\[\/size\])"
strContent=re.Replace(strContent,"
$2")
re.Pattern="(\[size=4\])(.[^\[]*)(\[\/size\])"
strContent=re.Replace(strContent,"
$2")
set re=Nothing
UBBCode=strContent
end function
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^UBB代码结束^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^