다음은 함수 소스 코드입니다.
<%
함수 테이크아웃(patrn,string1,colors)
'검색어와 일치하는 텍스트를 추출합니다
Dim regEx, Match, Matches, tt '변수를 생성합니다.
Set regEx = New RegExp ' 정규식을 만듭니다.
regEx.Pattern = patrn ' 패턴을 설정합니다.
regEx.IgnoreCase = True ' 대소문자 구분 여부를 설정합니다.
regEx.Global = True ' 전역 가용성을 설정합니다.
Set Matches = regEx.Execute(string1) '검색을 실행합니다.
일치 항목의 각 일치 항목에 대해 ' 일치 항목 컬렉션을 탐색합니다.
RetStr = RetStr & Match.Value &
다음
RetStr = 트림(RetStr)
instr(RetStr, )>0이면
tt = 0에서 ubound(split(RetStr, ))로
string1 = 대체(string1,split(RetStr, )(tt),<font color=&colors&>&split(RetStr, )(tt)&</font>)
다음
또 다른
string1 = 바꾸기(string1,RetStr,<font color=&colors&>&RetStr&</font>)
종료하면
테이크아웃 = string1
기능 종료
response.write 테이크아웃(jOeKOe, Joekoe 이중언어 버전, 빨간색)
Function Highlight(strContent,keyword) '강조된 키워드 표시
희미한 정규식
RegEx=new RegExp 설정
RegEx.IgnoreCase =True '대소문자를 구분하지 않음
RegEx.Global=참
희미한 배열키워드,i
ArrayKeyword = Split(keyword, ) '공백으로 구분된 여러 키워드
i=0인 경우 Ubound(ArrayKeyword)로
RegEx.Pattern=(&ArrayKeyword(i)&)
strContent=RegEx.Replace(strContent,<font color=red>$1</font> )
다음
RegEx=아무것도 설정하지 않음
하이라이트=strContent
기능 종료
response.write 하이라이트(Joekoe 이중언어 버전, jOeKOe)
%>
-