HTML search

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have adapted code found elsewhere,, to search through a collection of files
and return the complete line of text where the search string is found. The
files I am searching through are html files and the line returned contains
all the control characters as the file is opened as a text file. Is it
possible to open a file in html and hide the code, searching solely on the
text??

Open MyFileName For Input As #1 ' Open to read file.
Do Until EOF(1)
Line Input #1, MyFile
 
No, an html file is just a text file so you will always see the tags when you
open it to read. What you could do is to process each line as you read it:

Loop through the string copying each character to another variable.
When you find a '<' set an 'InTag' flag and stop copying.
When you find a '>' clear the flag and start copying again.

Note that it is possible for some tags to extend from one line to the next so
you will need to keep the status of the InTag flag between lines.

HTH
John
 
Back
Top