复制代码代码如下 :
'replaceSpattern withhighlightEdreplacement (사용 스타일) 및 프리 서비스 케이스
publicfunctionhighlight (strtext, strfind)
Dimobjregexp, i, strhighlight
'splitthesearchtermsintoanarray
Dimarrfind
arrfind = split (strfind, "")
'InitializetheRegularexpressionObjectToperfomThearcesearch
디모치, 스태치
setoregexp = NewRegexp
oregexp.global = true'returnsallmatchestothesearcherterm
oregexp.ignorecase = true'caseinsensive
'LOOPTHROWHEARRAYOFSEARCHTERTHSTOFINDATCHES
fori = 0toubound (arrfind)
oregexp.pattern = arrfind (i) 'setsthesearchpatternstring
setomatches = oregexp.execute (strtext) '// performsthesearch
foreachmatchinomatches
'BuildTheCodeBeusedToHighlightresultsults
strhighlight = "<spanclass =" "하이라이트" ">"& match.value & "</span>"
다음
'replaceMatchesfromthespreegromesteboveCode
strtext = oregexp.replace (strtext, strhighlight)
다음
하이라이트 = strtext
setobjregexp = 아무것도 없습니다
최종 기능 장애