Updated Answer to CSS Regex Question

I gave out a bit of duff information in my last post. Thanks Rasmus!

The code should have been:

string css = @”
string patt = @”.[-]?[_a-zA-Z][_a-zA-Z0-9-]|[^\0-\177]\[0-9a-f]{1,6}(\r\n[ \n\r\t\f])?|\[^\n\r\f0-9a-f]*“;
MatchCollection arr = Regex.Matches(css, patt);

The “arr” Collection will contain all the class names found in the input string. arr.Count will be the number of matches, and it can be indexed like so: arr[0].Value etc. etc.

Sorry about that :)

Paul Kinlan

Trying to make the web and developers better.

RSS Github Medium