.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification