Detta är en class som Patrik B har gjort har jag för mig:
<%
'Denna klass markerar upp sökta ord
Class MarkWord
Private m_intWordCount ' As Integer
Public Property Let WordCount(ByVal iWordCount) ' As Integer
m_intWordCount = iWordCount
End Property
Public Property Get WordCount
WordCount = m_intWordCount
End Property
Public Function MarkSearchedWords(ByVal sContent, ByVal sSearchedWord) ' As String
DIm objRegExp
Dim Matches
Dim Match
Set objRegExp = New RegExp
objRegExp.Global = True
objRegExp.IgnoreCase = true
objRegExp.Pattern = "" & Replace(sSearchedWord,".","\.")
Set Matches = objRegExp.Execute(sContent)
'## -- how many matches have we found --
WordCount = Matches.Count
'## -- mark every match with bold --
For Each Match In Matches
sContent = Replace(sContent,Match,"<b>" & Match & "</b>")
Next
Set matches = Nothing
Set objRegExp = Nothing
MarkSearchedWords = sContent
End Function
End Class
%>
