It really depends - do you need to know where the DOM is in your specific text? How big is the entrance? Will your line ever be split between two lines?
If you are only concerned about the presence of text, and your input is small enough to be in memory, I would just read it all in memory. I'm not sure which algorithm the CLR uses to match strings, but some of the faster routines include preprocessing both the query and the search string, and the presence of additional information for the preprocessing could potentially lead to a faster search.
Of course, all this depends on the internal properties of the CLR and your specific requirements - test, test, test.
If you want more information about your text and its relation to the surrounding document, I would suggest looking at HtmlAgility to analyze your document.
source share