The following is the function source code:
<%
Function Takeout(patrn,string1,colors)
'Extract search keyword matching text
Dim regEx, Match, Matches, tt 'Create variables.
Set regEx = New RegExp ' Create a regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = True ' Set whether to be case sensitive.
regEx.Global = True ' Set global availability.
Set Matches = regEx.Execute(string1) 'Execute search.
For Each Match in Matches ' Traverse the Matches collection.
RetStr = RetStr & Match.Value &
Next
RetStr = trim(RetStr)
if instr(RetStr, )>0 then
for tt = 0 to ubound(split(RetStr, ))
string1 = replace(string1,split(RetStr, )(tt),<font color=&colors&>&split(RetStr, )(tt)&</font>)
next
else
string1 = replace(string1,RetStr,<font color=&colors&>&RetStr&</font>)
end if
Takeout = string1
End Function
response.write Takeout(jOeKOe, Joekoe bilingual version, red)
Function Highlight(strContent,keyword) 'Mark highlighted keywords
Dim RegEx
Set RegEx=new RegExp
RegEx.IgnoreCase =True 'Not case sensitive
RegEx.Global=True
Dim ArrayKeyword,i
ArrayKeyword = Split(keyword, ) 'Multiple keywords separated by spaces
For i=0 To Ubound(ArrayKeyword)
RegEx.Pattern=(&ArrayKeyword(i)&)
strContent=RegEx.Replace(strContent,<font color=red>$1</font> )
Next
Set RegEx=Nothing
Highlight=strContent
End Function
response.write Highlight(Joekoe bilingual version, jOeKOe)
%>
-