title: What is the regex of a CSS selector
body: <p>I'd like to parse a CSS file and add another CSS selector before every CSS selector.</p>
  <p>From:</p>
  <pre><code>p{margin:0 0 10px;}
  .lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;}
  </code></pre>
  <p>I'd like:</p>
  <pre><code>.mySelector p{margin:0 0 10px;}
  .mySelector .lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;}
  </code></pre>
  <p>But my CSS file is really complex (in fact it is the bootstrap CSS file), so the regex should match all CSS selectors.</p>
  <p>For now, I have this regex:</p>
  <pre><code>([^\r\n,{};]+)(,|{)
  </code></pre>
  <p>And you can see the result here <a href="http://regexr.com?328ps" rel="nofollow noreferrer">http://regexr.com?328ps</a>, but as you can see, there are a lot of matches that shouldn't match.</p>
  <p>For example:</p>
  <pre><code>text-shadow:0 -1px 0 rgba(0,
  </code></pre>
  <p>matches positive but it shouldn't</p>
  <p>Does someone have a solution?</p>