C# CSS Classname Regex

As promised, although a little late I have updated the Regex to get CSS classnames via C#. The problem I had was that it would find file extensions in a url specified by the "url(xyz.png)" in an attribute.

I added a little negative look behind and now it seems to work prety well:

string css = @"
.someclass
{
background: white url(someimage.png) repeat-x top left;
}
.someclass2
{
background: white url ( someimage.png) repeat-x top left;
}
";
MatchCollection arr = Regex.Matches(css, @"(?<!url\s*\(.*)(\.[-]?[_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 class1 = arr[0].Value;
string class2 = arr[1].Value;

Technorati Tags
[feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed]

Related Wikipedia Documents
, , , , , , ,

My Related Documents
, ,

Related Amazon Books
Compressed Image File Formats: JPEG, PNG, GIF, XBM, BMP (ACM Press S.): / PNG: The Definitive Guide: / Web Designer's Guide to PNG, GIF, JPEG: / CSS Pocket Reference: / Professional CSS: Cascading Style Sheets for Web Design: / Regular Expression Pocket Reference: / Regular Expression Recipes: A Problem-Solution Approach: / Regular Expression Recipes for Windows Developers: a Problem-solution Approach: /

Related Images From Flickr
[[posterous-content:gIqkxozkegqnkrboHwoo]][[posterous-content:fFbzfthIoCtzosInvHca]][[posterous-content:annJwapDjijadfBcwizg]][[posterous-content:EAHCAGjzEbHycHgsIfxs]]