. Topicala Page Index Token

A Journal about the experiences I have developing little applications in C#, Perl, Html and Javascript and talking about things new things that I use. Always Geeky; Always Nerdy; Always poor Grammer!

I am a Software Analyst Developer working in Southport, England but living in Liverpool. I develop mainly in C# and ASP.Net. I have been developing comercial software for several years now. I maintain this site (hosted at SwitchMedia UK) as a way of exploring new technologies (such as AJAX) and just generally talking about techie geek issues. This site is developed through a host of Perl scripts and a liberal use of Javascript. I enjoy experimenting with new technologies and anything that I make I host here.

Quick Search

Web www.kinlan.co.uk

Monday, February 06, 2006

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 :)

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

Related Wikipedia Documents
, , ,

My Related Documents

Related Amazon Books
The ZEN of CSS Design: Visual Enlightenment for the Web: / CSS Pocket Reference: / Professional CSS: / Eric Meyer on CSS: /

Related Images From Flickr

Comments: [Add New]

Thank you very much for your help!

By Rasmus, at Wednesday, February 08, 2006 5:51:00 AM

I was looking for exactly the same thing and tried your pattern, but unfortunatley it chokes on this:

background: white url(someimage.png) repeat-x top left;

The regex picks up '.png'

By Anonymous, at Saturday, February 18, 2006 7:36:00 AM

I'll look into it and post a new Regex :)

By Paul Kinlan, at Saturday, February 18, 2006 11:36:00 AM