|
<body><form action=find.asp method=post> <input name=getkey> <select name=gettype> <option value=basic selected>Basic <option value=advance>Advance </select><input type=submit value=find> </form><hr> <% dim ar, getkey, gettype, allrec getkey = request.form("getkey") gettype = request.form("gettype") set ftxt=createobject("scripting.filesystemobject") set ln = ftxt.opentextfile(server.mappath("/cgi-bin/search.dat")) if gettype = "basic" then response.write("<ol>") do while not ln.atendofstream recline = ln.readline ar = split(recline,":",-1,1) if instr(lcase(recline),lcase(getkey)) > 0 then response.write("<li>" & ar(0)) response.write(" <a href=http://" & ar(1) &">") response.write(ar(1) &"</a> " & ar(2)) end if loop response.write("</ol>") end if if gettype = "advance" then allrec = ln.readall set re = new regexp re.ignorecase = true re.global = true re.pattern = getkey set matches = re.execute(allrec) response.write("Find for [ "& getkey &" ]<br>") for each match in matches response.write("Position : "& match.firstindex & " - ") response.write(match.value & "<br>") next if matches.count > 0 then response.write("Found : " & matches.count) else response.write "<hr>Find : Not found" end if end if ln.close %></body> |