我是靠谱客的博主 繁荣唇膏,这篇文章主要介绍自动识别HTML的标记 替换连接,现在分享给大家,希望可以做个参考。

复制代码 代码如下:

<%
Function SenFe_UbbCode(sContent)
    Dim TempReg
    Set TempReg = New RegExp
    With TempReg
        .IgnoreCase = True
        .Global = True
        '自动识别网址
        If InStr(Lcase(sContent),"http://")>0 Then
            .Pattern = "(^|[^<=""])(http:(\/\/|\\\\)(([\w\/\\\+\-~`@:%])+\.)+([\w\/\\\.\=\?\+\-~`@\':!%#]|(&)|&)+)"
            sContent = .Replace(sContent,"$1<a href=""$2"" target=""_blank"">$2</a>")
        End If
        '自动识别www等开头的网址
        If InStr(Lcase(sContent),"www.")>0 or InStr(Lcase(sContent),"bbs.")>0 Then
            .Pattern = "(^|[^\/\\\w\=])((www|bbs)\.(\w)+\.([\w\/\\\.\=\?\+\-~`@\'!%#]|(&))+)"
            sContent = .Replace(sContent,"$1<a href=""http://$2"" target=""_blank"">$2</a>")
        End If
    End With
    Set TempReg = Nothing
    SenFe_UbbCode = sContent
End Function
%>




[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

最后

以上就是繁荣唇膏最近收集整理的关于自动识别HTML的标记 替换连接的全部内容,更多相关自动识别HTML的标记内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部