Avatar of dkim18

asked on 

searching string from a text file?


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)
                return true;
                return false;

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?
.NET ProgrammingC#

Avatar of undefined
Last Comment

8/22/2022 - Mon