I am designing a crawler that will get certain content from a web page (using either string manipulation or regular expression).
I can get the contents of the webpage as a response stream (using the entire httpwebrequest article), and then for testing / dev purposes, I write the contents of the stream in a multi-line text box in my ASP.NET webpage.
Is it possible for me to go through the contents of the text field and then say: βIf textbox1.text.contains (or save the text of the text field as a string variable), a particular line then increments the counter.β The problem with the text field is that the line loses formatting, so in one long line without interrupting the line. Can it be changed?
I would like to do this, rather than writing the contents to a file, because writing to a file means that I will have to handle all kinds of external problems. Of course, if this is the only way, then so be it. If I have to write to a file, then what is the best strategy for scrolling through each line (I'm a bit overloaded and thus confused, since there are a lot of logical and language methods to use) looking for a condition? Therefore, if I want to search for the string "Hello" in the following text:
My name is xyz I'm xyz yo Hi blah blah blah Bye
When I get hello, I want to increment an integer variable.
Thank,
Gss
source
share