[Mono-list] Anyone Have Problems With RegexOptions.Singleline in a Regex.Replace?

David P. Donahue ddonahue at ccs.neu.edu
Wed Jul 27 09:14:50 EDT 2005

I'm trying to use the following code to read in a file on my web server 
and display part of its contents (sorry for wrapping):

StreamReader streamReaderFile = new StreamReader("/path/to/file.html");
string stringFile = streamReaderFile.ReadToEnd();
stringFile = Regex.Replace(stringFile,
      "<br>", RegexOptions.Singleline);

But the web server seems to be timing out on the third line, where the 
Regex is executed.  It doesn't time out if I don't use the Singleline 
option, but then of course it doesn't do what I need it to do.  It's 
supposed to be just getting rid of everything in the HTML file up to and 
including a comment I placed there:
"<!-- ------------ START HERE ------------ -->"

Any ideas what I'm doing wrong?

David P. Donahue
ddonahue at ccs.neu.edu

More information about the Mono-list mailing list