title: PHP regular expression match 'fill1 pc1' or 'pc1'
body: <p>In a project we are having so many svg images with the following paths:</p>
  
  <p>Image 1:</p>
  
  <pre><code>&lt;path class="fill1 pc1" d="M4276 1802c223,-13 453,84 681,152 21,6 43,12 64,18 21,6 42,11 63,16l264 -799c-27,-20 -54,-40 -83,-60 -492,-345 -1232,-645 -2076,-889 -6,49 -3,59 -20,105 158,101 284,176 388,283 164,166 284,354 371,559 56,131 95,268 153,388 47,97 121,157 195,227z"/&gt;
  </code></pre>
  
  <p>Image 2:</p>
  
  <pre><code> &lt;path class="pc1" d="M4276 1802c223,-13 453,84 681,152 21,6 43,12 64,18 21,6 42,11 63,16l264 -799c-27,-20 -54,-40 -83,-60 -492,-345 -1232,-645 -2076,-889 -6,49 -3,59 -20,105 158,101 284,176 388,283 164,166 284,354 371,559 56,131 95,268 153,388 47,97 121,157 195,227z"/&gt;
  </code></pre>
  
  <p>I can use the following regular expression to match:</p>
  
  <pre><code>$svg = preg_replace(
       '/class="fil[0-9]\s+pc1"/',  
      'class="fil${1}\s+pc1" style="fill: rgb('.$r.','.$g.','.$b.');"',
      $svg                  
  );
  </code></pre>
  
  <p>The above code will replace the path's class match with <strong>class="fill1 pc1"</strong> this only. some times the "fill1" wont be there. How can i replace this?</p>