searching string from a text file?
Posted on 2011-10-04
I am trying find a string (it will be an URI) from a text file containing lines of URIs.
basically each line has an URI.
I was trying to use this Regex method but I am getting the unescape character problem.
readFile = new System.IO.StreamReader("StatusLog.txt");
string allRead = readFile.ReadToEnd();
//If the match is found in allRead
if (Regex.IsMatch(allRead, fileName)
Is there a way to fix this problem?
I am looking at the Regex.Escape() but not sure how to use it.
Is there another way I can search the string?
Should I do while loop and readline(), then compare?
Can't think a better way to do this?