I wanna build a program to crawl some websites, check for the style.css file, open it, and with a Regex which is #([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])(?=;) I want to get the top 5 colors of the style.css
If there are 200 colors in my regex result, I wanna get the top 5 meaning.
For example my regex will find this color #ffffff 100 times, which means this will be my first color.
The color #343434 will be found 98 times, this will be my second color.
And so on to get the top 5 colors from the style.css file.
Any ideas on how to implement this ?
I found this sort of example on here:
var l1 = new List<int>() { 1,2,3,4,5,2,2,2,4,4,4,1 };
var g = l1.GroupBy( i => i );
foreach( var grp in g )
{
Console.WriteLine( "{0} {1}", grp.Key, grp.Count() );
}
But it’s not really what I’m looking for.
Any ideas are welcome.
Thanks in advance.
You can try something like: