最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Highlight patterns within strings

 更新時間:2007年04月04日 00:00:00   作者:  

復(fù)制代碼 代碼如下:

'Replaces pattern with highlighted replacement (using style) and preserves case  
Public Function highlight(strText, strFind)  
    Dim objRegExp, i, strHighlight  

    'Split the search terms into an array  
    Dim arrFind  
    arrFind = Split(strFind, " ")  

    'Initialize the regular expression object to perfom the search  
    Dim oMatches, sMatch  
    Set oregExp = New RegExp  

    oregExp.Global = True 'Returns all matches to the search term  
    oregExp.IgnoreCase = True 'Case insensitive  

    'Loop through the array of search terms to find matches  
    For i = 0 to UBound(arrFind)  
        oregExp.Pattern = arrFind(i) 'Sets the search pattern string  
        Set oMatches = oregExp.Execute(strText) '// performs the search   
        for each match in oMatches  
            'Build the code to be used to highlight results  
            strHighlight = "<span class=""highlight"">" & match.value & "</span>"  
        next  
        'Replace matches from the search with the above code  
        strText = oregExp.Replace(strText, strHighlight)  
     Next  

    highlight = strText  

    Set objRegExp = Nothing  
End Function

相關(guān)文章

最新評論

霍邱县| 瑞安市| 新田县| 松桃| 长汀县| 丹寨县| 高平市| 肥乡县| 天气| 南郑县| 西宁市| 朝阳县| 通州区| 定结县| 拉萨市| 招远市| 义马市| 靖宇县| 元谋县| 当雄县| 京山县| 闻喜县| 安龙县| 阳新县| 西乌珠穆沁旗| 海南省| 苏州市| 靖远县| 旬邑县| 丽水市| 巴楚县| 贵阳市| 建平县| 青州市| 独山县| 台中县| 梧州市| 白水县| 德惠市| 绩溪县| 屏东市|