以下は関数のソースコードです。
<%
関数の取り出し(パターン,文字列1,色)
'検索キーワードに一致する文字列を抽出
Dim regEx、Match、Matches、tt '変数を作成します。
Set regEx = New RegExp ' 正規表現を作成します。
regEx.Pattern = patrn ' パターンを設定します。
regEx.IgnoreCase = True ' 大文字と小文字を区別するかどうかを設定します。
regEx.Global = True ' グローバルな可用性を設定します。
Set Matches = regEx.Execute(string1) '検索を実行します。
Matches の各一致について ' Matches コレクションをトラバースします。
RetStr = RetStr & Match.Value &
次
RetStr = トリム(RetStr)
if instr(RetStr, )>0 then
tt = 0 から ubound(split(RetStr, )) の場合
string1 = replace(string1,split(RetStr, )(tt),<font color=&colors&>&split(RetStr, )(tt)&</font>)
次
それ以外
string1 = replace(string1,RetStr,<font color=&colors&>&RetStr&</font>)
終了する場合
取り出し = string1
終了機能
response.write Takeout(jOeKOe、ジョーコエ バイリンガル版、赤)
Function Highlight(strContent,keyword) '強調表示されたキーワードをマークします
ディム正規表現
RegEx=新しい正規表現を設定します
RegEx.IgnoreCase =True '大文字と小文字を区別しません
RegEx.Global=True
Dim ArrayKeyword,i
ArrayKeyword = Split(keyword, ) 'スペースで区切られた複数のキーワード
i=0 から Ubound(ArrayKeyword) へ
RegEx.Pattern=(&ArrayKeyword(i)&)
strContent=RegEx.Replace(strContent,<font color=red>$1</font> )
次
RegEx=Nothing を設定します
ハイライト=strContent
終了機能
response.write ハイライト(Joekoe バイリンガル版、jOeKOe)
%>
-