1、要实现的功能: 从类似于 “
http://xxx.com/o111k/index.htm” 中提取“o111k”
2、代码
<%
function ubbcode(patrn, content)
dim i,regex, match, matches,tempArray()
set regex = new regexp
regex.pattern = patrn
regex.ignorecase = true
regex.global = true
set matches = regex.execute(content)
for each match in matches
ubbcode = regex.Replace(match.Value,"$2")
next
else
redim tempArray(matches.count) '匹配的次数很多,则返回
数组
i = 0
for each match in matches
tempArray(i) = regex.Replace(match.Value,"$2")
i=i+1
next
ubbcode = tempArray
set matches = nothing
end function
other_c
http://xxx.com/okk/index.htm">http://xxx.com/okk/index.htm
http://xxx.com/o111k/index.htm http://xxx.com/o111kk/index.htm"
obj_patrn = ubbcode("(com\/)(.[^\[]*)(\/index])", other_content)
for j = 0 to ubound(obj_patrn)
response.Write obj_patrn(j)&"</p>"
next
%>