复制代码 代码如下:
<%
FunctionSenFe_UbbCode(sContent)
DimTempReg
SetTempReg=NewRegExp
WithTempReg
.IgnoreCase=True
.Global=True
'自动识别网址
IfInStr(Lcase(sContent),"http://")>0Then
.Pattern="(^|[^<=""])(http:(\/\/|\\\\)(([\w\/\\\+\-~`@:%])+\.)+([\w\/\\\.\=\?\+\-~`@\':!%#]|(&)|&)+)"
sContent=.Replace(sContent,"$1<ahref=""$2""target=""_blank"">$2</a>")
EndIf
'自动识别www等开头的网址
IfInStr(Lcase(sContent),"www.")>0orInStr(Lcase(sContent),"bbs.")>0Then
.Pattern="(^|[^\/\\\w\=])((www|bbs)\.(\w)+\.([\w\/\\\.\=\?\+\-~`@\'!%#]|(&))+)"
sContent=.Replace(sContent,"$1<ahref=""http://$2""target=""_blank"">$2</a>")
EndIf
EndWith
SetTempReg=Nothing
SenFe_UbbCode=sContent
EndFunction
%>
[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
