I\'d like to parce a CSS file and add before every CSS selector another selector.
From:
p{margin:0 0 10px;}
.lead{margin-bottom:20px;font-size:21px;font-
So I've finally found a REGEX that works for my requirements
([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)
The key point was to add a Positive lookahead to avoid bad matches
(?=[^}]*{)
You can see the result here: http://regexr.com?328s7
The only precaution that I can recommend is to remove every block comment: