Click to See Complete Forum and Search --> : searching with asp


dvdljns
08-02-2004, 08:24 AM
Anybody have any info on getting asp to search a text file. I need a script or something that will find all instances of a word. I was sure file system object would do that and have found some great articles on file system object but nothing on doing this. I can search drives,dir, and folders but not text. Is this something I would be better off doing with javascript.

bddosch
08-04-2004, 04:26 AM
Basically you should use the file system object and loop through every line in a text file. While looping through each line, try and use something like the following to search what you are looking for:

If InStr(1,theTextFileRow,SearchWord,1) Then
add result to array
End If

Read this to help you explain inStr:

http://www.w3schools.com/vbscript/func_instr.asp