CSS Parser Wanted

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a way to extract css class names from a css file. Therefore I’m
looking for a CSS Parser, preferably freeware and written in C#.

Anybody know of such one?
 
Thanks for the quick reply.

I'm not too good at using regex in c#. Could you provide a snippet of sample
code?
 
Can't seem to get it to work...



static void Main(string[] args){
string css = @"
..class1{
color:pink;
}

..class2{
color:blue;
}";

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]*";
string[] arr = Regex.Split(css, patt);
}
 
Back
Top