TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James Webb
NA
11
9.5k
Getting Data from HTML Web Page Problem
Jun 22 2014 8:41 AM
Hi all,
I'm just learning C# at the moment and I'm playing with extracting data from webpages using Regex.
Im having problems getting data out of an unordered list. This is the HTML:
<ul class="ad-footer-info">
<li>Ad ref <span class="ad-id">1069691339</span></li>
<li>Posted 13 hours ago</li>
<li>Posting ads since June 2014</li></ul>
I'm trying to get the data that says "posted 13 hours ago" but I cant get it to work. (I'll post my attempt below)
Any help would be very much appreciated.
Many Thanks and Kind Regards,
James Webb
_____________________________________________________________________
My Code:
public void GetDateAdded()
{
string UserURL = textBox1.Text;
WebClient MyWebClient = new WebClient();
String HTMLString = MyWebClient.DownloadString(UserURL);
MatchCollection MatchedDates = Regex.Matches(HTMLString, "<ul class=\"ad-footer-info\">\\s*(.+?)\\s*</ul>", RegexOptions.Singleline);
}
Reply
Answers (
2
)
Extracting Data from Website
MVP