My code is:
htmltoextract = new Uri("http://test");
client = new WebClient();
f = client.DownloadString(htmltoextract);
client.Dispose();
string pattern = @"(\d{12})";
Regex ex = new Regex(pattern, RegexOptions.Singleline);
MatchCollection matches = ex.Matches(f);
IFormatProvider provider = CultureInfo.InvariantCulture;
List<DateTime> dateTime = new List<DateTime>();
foreach (Match match in matches)
{
dateTime.Add(DateTime.ParseExact(match.Value, "yyyyMMddHHmm", provider));
}
Inside f
somewhere inside i have this line:
var imageUrls = ["/image2.ashx?region=is&time=201501102145&ir=false","/image2.ashx?region=is&time=201501102130&ir=false","/image2.ashx?region=is&time=201501102115&ir=false","/image2.ashx?region=is&time=201501102100&ir=false","/image2.ashx?region=is&time=201501102045&ir=false","/image2.ashx?region=is&time=201501102030&ir=false","/image2.ashx?region=is&time=201501102015&ir=false","/image2.ashx?region=is&time=201501102000&ir=false","/image2.ashx?region=is&time=201501101945&ir=false"];
I need to extract it twice to two Lists:
The first List is dateTime
The second List should be string and it should add it to it:
/image2.ashx?region=is&time=201501102145&ir=false
/image2.ashx?region=is&time=201501102130&ir=false
/image2.ashx?region=is&time=201501102115&ir=false
/image2.ashx?region=is&time=201501102100&ir=false
/image2.ashx?region=is&time=201501102045&ir=false
/image2.ashx?region=is&time=201501102030&ir=false
/image2.ashx?region=is&time=201501102015&ir=false
/image2.ashx?region=is&time=201501102000&ir=false
/image2.ashx?region=is&time=201501101945&ir=false
I have Two problems:
How do I extract the times and the strings /image2.ashx?region=is&time=201501101945&ir=false
how do I extract it all only from the part:var imageUrls = ["........
Since inside f
there are other places with this times I need to extract it only from the part start from var imageUrls = [" and end with "];