欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ASP為字符串中的網(wǎng)址自動加上鏈接

 更新時間:2008年06月25日 17:12:44   作者:  
asp下用正則實現(xiàn)字符串中的網(wǎng)址加鏈接的代碼
<%
'字段內(nèi)網(wǎng)址加上聯(lián)接。
Function ToLink(Str)
    Dim RE '正則表達(dá)式對象     Dim strContent
    If IsNull(Str) Then Str = ""
    Set RE = New RegExp '創(chuàng)建正 則表達(dá)式對象
    With RE
        .Global = True '搜索應(yīng)用于整個字符串
        .IgnoreCase = True '搜索不區(qū)分大小寫的
        strContent = Str
        '***************************************************************
        '郵件地址鏈接自動設(shè)置
        '***************************************************************
        .Pattern = "([\w]*)@([\w\.]*)"
        strContent = .Replace(strContent, "<A Href='mailto:$1@$2'>$1@$2</A> ")
        '***************************************************************
        '鏈接自動設(shè)置
        '***************************************************************
        '======根據(jù)要求再添加協(xié)議名稱=======
        Dim D(3), I
        D(0) = "http"
        D(1) = "ftp"
        D(2) = "news"
        D(3) = "mms"
        '===================================
        For I = 0 To UBound(D)
            .Pattern = D(I) + ":\/\/([\w\.]*)"
            strContent = .Replace(strContent, "<A Href='" + D(I) + "://$1' target=_blank>" + D(I) + "://$1</A> ")
        Next
        '***************************************************************
    End With
    Set RE = Nothing
    ToLink = strContent
End Function

%>

相關(guān)文章

最新評論