473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

RegexOptions.Singleline is causing a timeout?

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 = System.Text.RegularExpressions.Regex.Replace(strin gFile,
@".*<!-+\s*-+\s*START\s*HERE\s*-+\s*-->",
"<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?
Regards,
David P. Donahue
dd******@ccs.neu.edu
http://www.cyber0ne.com
Nov 17 '05 #1
1 2216
David P. Donahue wrote:

<snip>
Any ideas what I'm doing wrong?


I tried your code to be sure and I think you are not really doing
anything wrong. It works fine for me in a sample program. What I would
do now is try to decouple things and get behind the real reason for the
failure:

- Create a simple sample application that has nothing to do with the
web server and put the code in there.

- Extract the exact data that the web server sees from the method
(e.g. by writing the streamReaderFile contents to another file) and use
that data with your test program.

This way you'll be able to find out reliably if the problem lies with
the code, the data, or with a specific detail about the web server itself.

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Plymouth Acclaim | last post by:
Hi guys, We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared...
6
by: harry | last post by:
Hi, I have a program that runs on multiple client pc's. Occasionally one or more of those pc's use VPN to connect to another corporate network. When using VPN they need to set proxy server in...
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
0
by: phil.a.jenkins | last post by:
Hopefully someone can provide a solution to this rather annoying problem - we have a Cocoon pipeline which ends thus: <!-- build the sql for insert and final stage of select --> T1 ...
1
by: pl | last post by:
Hello, I have a quick question, I would like to use multiple RegexOptions like RegexOptions.SingleLine and RegexOptions.IgnoreCase at the same time, but I haven't been able to find any resource...
1
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I want to match some HTML string using Regex but the linebreaks are getting me. Is there a way to just completely ignore linebreaks in my regular expression? If not, how would I specify a...
1
by: GS | last post by:
I got a bunch of check boxes to represent regexoptions. converting that to one single regexoptions for storing in the database is easy. what about the other way, from database int to regexoptions...
6
by: GS | last post by:
I tried converting regexoptions to bits sp I can do bitwise operation but I just could not get it going. I tried Google, so far I failed to find the answer. any hint? what is happening, is...
0
by: AAaron123 | last post by:
The RegexOptions Enumeration contains: Multiline ExplicitCapture Compiled Singleline IgnorePatternWhitespace RightToLeft ECMAScript CultureInvariant
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.