Search:
Namespaces
Discussions
.NET v1.1
Feedback
RegEx Parsing Error
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngregexp' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Devin Rader
I am trying to screen scrape some data from weather.com, but when I load the
Response Stream into a
Regex
object as the string pattern, it gives this
exception at run-time:
Server Error in '/myApp' Application
parsing ".... the source of weather.com page goes here...."
Source Error
Line 55:
Regex
regexp = new
Regex
(result);
Heres my scrapeing code:
string result;
WebResponse objResponse;
WebRequest objRequest System.Net.
HttpWebRequest
.Create("
http://www.weather.com/weather/local/63141
");
objResponse = objRequest.GetResponse();
StreamReader sr = new
StreamReader
(objResponse.GetResponseStream());
result = sr.ReadToEnd();
I have tried using different
Regex
Options, but it always ends up with this
error. Anyone have any ideas?
Thanks
devin
stlnet.org
Reply to this message...
Scott Mitchell (VIP)
RegEx Parsing ErrorI think you are using the Regeex class incorrectly. Note
the docs:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemtextregularexpressionsrege
xclassctortopic2.htm ; if you pass in a string through the constructor it
should be the pattern. Patterns, for regular expressions, are like:
[0-9]{3}
to match three consecutive digits, for example. There are special
characters in a pattern (like (, ), ^, etc.) and I would be some appearances
of these in the string of the HTML of Weather.com is what is causing the
problem.
Do you mean to search this string based on another regexp pattern? That's
more likely what you're wanting to do, in which case specify the pattern in
the constrcutor then use the Replace or Match(s) methods to find occurrences
of the pattern in the HTML from Weather.com.
Scott Mitchell
Click here to reveal e-mail address
http://www.4GuysFromRolla.com/
http://www.ASPMessageboard.com/
http://www.ASPFAQs.com/
* When you think ASP, think 4GuysFromRolla.com!
-----Original Message-----
From: Devin Rader [mailto:
Click here to reveal e-mail address
]
Sent: Monday, January 14, 2002 11:22 AM
To: aspngregexp
Subject: [aspngregexp] RegEx Parsing Error
I am trying to screen scrape some data from weather.com, but when I load
the Response Stream into a
Regex
object as the string pattern, it gives this
exception at run-time:
Server Error in '/myApp' Application
parsing ".... the source of weather.com page goes here...."
Source Error
Line 55:
Regex
regexp = new
Regex
(result);
Heres my scrapeing code:
string result;
WebResponse
objResponse;
WebRequest
objRequest System.Net.
HttpWebRequest
.Create("
http://www.weather.com/weather/local/63141
");
objResponse = objRequest.GetResponse();
StreamReader
sr = new
StreamReader
(objResponse.GetResponseStream());
result = sr.ReadToEnd();
I have tried using different
Regex
Options, but it always ends up with
this error. Anyone have any ideas?
Thanks
devin
stlnet.org
| [aspngregexp] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/asplists/aspngregexp.asp
= JOIN/QUIT |
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
System.IO.StreamReader
System.Net.HttpWebRequest
System.Net.WebRequest
System.Net.WebResponse
System.Text.RegularExpressions.Regex
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com