By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

Regular Expression Frustration

P: n/a
Greetings,

I'm using a custom WebBrowser control:
http://www.codeproject.com/KB/miscctrl/csEXWB.aspx
When I get the DocumentSource of a web page I browsed, and run a regular
expression against it, the Expression never matches anything, nothing,
nadda. Never. I know it is a correct Regular Expression because if I use
the intrinsic WebBrowser control, it the expression works. I know that if I
view the DocumentSource in the Text Visualizer, and copy-paste the contents
into Regulator, the regular expresssion works. If I write the contents of
the DocumentSource to a file of any encoding (tried ASCII, UTF8 and
Unicode), then open that file in any text editor and run a Regular
Expression search (even from within Visual Studio itself), it matches
exactly what I want. But even though Visual Studio itself matches it, if I
then load that same file and run Regex.Matches against it, it won't ever
match anything try as I might.

But Regex class will never match it, even if I load the text file into
another variable and Regex that instead, it'll never match. I'm trying to
figure out what kind of problems this could be. I have tried normalizing
the encoding, even examining the memory locations and I can't see any
encoding problems. But I'm at a loss. I have encountered this problem once
in the past consuming Web Services but do not recall the solution, and this
was many years ago..

I'm using Visual Studio 2008 Team Suite but I can replicate the problem in
Visual Studio 2005, also.

Perhaps someone here can identify the symptoms and already knows what the
problem is.
Thanks,
Shawn
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
But Regex class will never match it, even if I load the text file into
another variable and Regex that instead, it'll never match. I'm trying to
Well, even though it worked just fine yesterday and weeks and months before
that, after 12 hours trying to figure out what the problem is, I finally
decided to play with options and that did the trick:

Regex regex = new Regex(pattern, RegexOptions.ECMAScript |
RegexOptions.IgnoreCase);
Thanks,
Shawn
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.