title: Regular expression replace preserving groups
body: <p>Is there a way with regular expression to transform:<br>
  <code>M134.02,43.35c-12.62,1.4-29.25,6.59-39.85,19.65l15.35-5.82c26.24-18.1,54.45-10.65,62.99-0.11l1.27,1.34l0.02-0.04C169.6,49.83,155.11,41.01,134.02,43.35</code></p>
  
  <p>into:  </p>
  
  <pre><code>["M", 134.02, 43.35],
  ["c", -12.62, 1.4, -29.25, 6.59, -39.85, 19.65],
  ["l", 15.35, -5.82]
  // and so on...
  </code></pre>
  
  <p>I have currently set up this regex:<br>
  <code>([a-zA-Z])(-?(\d+(\.\d+)?),?)+</code></p>
  
  <p>But, replacing it with:<br>
  <code>["$1", $2]\n</code></p>
  
  <p>Takes only the last digit value, resulting in:  </p>
  
  <pre><code>["M", 43.35],
  ["c", 19.65],
  ["l", -5.82],
  ["c", -0.11],
  ["l", 1.34],
  ["l", -0.04],
  ["C", 43.35],
  </code></pre>
  
  <p>Well, I do not need to do it in one regex (though, preferred), I am just looking forward to utilize IDE's <code>Find &amp; Replace + Regex</code> to transform <a href="http://readysetraphael.com/" rel="nofollow">http://readysetraphael.com/</a> generated string paths to Array paths.</p>
  
  <p>My IDE is phpStorm, so I guess it takes Java friendly regex patterns. I'm not Java developer though, so I do not know what extra options I have there.</p>