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);
}