title: regular expression global pattern matching
body: <p>I do not repeat units in series (eg, 4, 6.5, 8, and 12 cm), except repeat % after each number
  the series can be of any length,hence i want regex pattern to be global.
  I have attached my sample program.</p>
  
  <pre><code>&lt;?php
  $match = '4 CM,6.5 CM';
  
  $replacement='$1$2$3';
  $replac = preg_replace('/(,?\d+\s?\W?)\w+?(,?\d+\s?\W?)(\w+)?/',
                     $replacement,
                     $match);
  echo $replac;
  ?&gt;
  </code></pre>
  
  <p>input:</p>
  
  <pre><code>4 CM,6.5 CM
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>4 ,6.5 CM
  </code></pre>
  
  <p>Expected result:</p>
  
  <p>input:</p>
  
  <pre><code>4 cm,6.5 cm,8 cm,9 cm and 10 cm  //the series can be of any length
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>4,6.5,8,9 and 10 cm   //units at the end
  </code></pre>
  
  <p>help me out to make my regex as a global one.So that it can check for any number of series.
  thanks.</p>