Posted By

mocha0range on 08/04/09


regex css regular expressions styles

Versions (?)

Who likes this?

4 people have marked this snippet as a favorite


Find CSS Attributes

 / Published in: Regular Expression

This finds individual CSS attributes, i.e. "foo : bar;" or "bar : 2px solid foo;"

  1. ^\s*[a-zA-Z\-]+\s*[:]{1}\s[a-zA-Z0-9\s.#]+[;]{1}

Report this snippet  


RSS Icon Subscribe to comments
Posted By: shekky on November 12, 2009

This will only capture the first attribute value pair, but if there are multiple attributes they are not capured.

Posted By: shekky on November 12, 2009

I created a regex that will capture all of the attributes


Posted By: on September 11, 2018

the 8 best 1080p tv for gaming the8best

You need to login to post a comment.