SoFunction
Updated on 2025-03-01

Automatically identify HTML tags Replace connections


<%
Function SenFe_UbbCode(sContent)
    Dim TempReg
    Set TempReg = New RegExp
    With TempReg
        .IgnoreCase = True
        .Global = True
'Automatically identify the URL
        If InStr(Lcase(sContent),"http://")>0 Then
            .Pattern = "(^|[^<=""])(http:(\/\/|\\\\)(([\w\/\\\+\-~`@:%])+\.)+([\w\/\\\.\=\?\+\-~`@\':!%#]|(&)|&)+)"
            sContent = .Replace(sContent,"$1<a href=""$2"" target=""_blank"">$2</a>")
        End If
'Automatically identify the URLs starting with www, etc.
        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
%>