I have this web server data collected in a string array. which i am aligning properly using Regex
for better readable format.
string[] liness = Regex.Split(html, "\r\n");
data inside liness
now looks like this.
<html><head><title>137.55.124.65 - /</title></head><body><H1>137.55.124.65 - /</H1><hr>
Thursday, June 7, 2018 6:27 PM <dir> <A HREF="/2.5.25557/">2.5.25557</A>
Thursday, June 14, 2018 5:25 PM <dir> <A HREF="/2.5.25569/">2.5.25569</A>
Wednesday, June 20, 2018 8:34 AM <dir> <A HREF="/2.5.25578/">2.5.25578</A>
Wednesday, June 20, 2018 5:33 PM <dir> <A HREF="/2.5.25580/">2.5.25580</A>
Tuesday, June 26, 2018 8:36 AM <dir> <A HREF="/2.5.25581/">2.5.25581</A>
Friday, June 29, 2018 8:36 AM <dir> <A HREF="/2.5.25582/">2.5.25582</A>
Tuesday, July 3, 2018 8:35 AM <dir> <A HREF="/2.5.25584/">2.5.25584</A>
Thursday, July 5, 2018 8:35 AM <dir> <A HREF="/2.5.25586/">2.5.25586</A>
Monday, July 16, 2018 8:33 AM <dir> <A HREF="/2.5.25587/">2.5.25587</A>
Tuesday, May 29, 2018 8:30 PM 696 <A HREF="/iisstart.htm">iisstart.htm</A>
Tuesday, May 29, 2018 8:30 PM 98757 <A HREF="/iisstart.png">iisstart.png</A>
Wednesday, November 19, 2014 3:41 PM 214 <A HREF="/index.html">index.html</A>
How better ways can i extract only the values which starts with 2.*.**** (ex: 2.5.8827)
and if you notice each line has HREF="/2.5.25425/">
also which is a duplicate value.
parse and put all of those values into a list and then this is the tricky part
get the highest version number( a single value )
ex: 2.5.1000 , 2.5 1001. 2.5.1002. 2.5.1003.
my highest version from the above example list is 2.5.1003
i have tried the above using regex.
List<string> versionvalue = new List<string>();
string pattern = "2.";
foreach (String l_html in liness)
{
string[] substrings = Regex.m(l_html, pattern);
//versionvalue.Add(substrings[]);
if ((l_html.Contains("2.")) && (l_html.Contains(currentYear.ToString()) ))
{
}
}
but looks very messed up and did not find any values i was looking for.
will regex.matches
work ?
all help appreciated!