title: Regex for multiple replace of Colorcode
body: <p>i have prefixe for groupnames in a database, they consist of normal text and color codes eg.:
  &amp;c[&amp;aAdmin&amp;c]. The colorcodes start with an &amp; and then one character or a number. they end on the next colorcode or the end of the string. 
  There are no &amp; as text in the string.
  For now i have this function, but it only can handle one colorcode at the beginning of the string. any suggestions for a nice regex replace to handle multiple colorcodes in one string?</p>
  
  <pre><code>function mccolor($string){
  $codes  = array(        "&amp;0",
                          "&amp;1",
                          "&amp;2",
                          "&amp;3",
                          "&amp;4",
                          "&amp;5",
                          "&amp;6",
                          "&amp;7",
                          "&amp;8",
                          "&amp;9",
                          "&amp;a",
                          "&amp;b",
                          "&amp;c",
                          "&amp;d",
                          "&amp;e",
                          "&amp;f");
  $replace  = array(
                          '&lt;span style="color:#000000;"&gt;',
                          '&lt;span style="color:#0000BF;"&gt;',
                          '&lt;span style="color:#00BF00;"&gt;',
                          '&lt;span style="color:#00BFBF;"&gt;',
                          '&lt;span style="color:#BF0000;"&gt;',
                          '&lt;span style="color:#BF00BF;"&gt;',
                          '&lt;span style="color:#BFBF00;"&gt;',
                          '&lt;span style="color:#BFBFBF;"&gt;',
                          '&lt;span style="color:#404040;"&gt;',
                          '&lt;span style="color:#4040FF;"&gt;',
                          '&lt;span style="color:#40FF40;"&gt;',
                          '&lt;span style="color:#40FFFF;"&gt;',
                          '&lt;span style="color:#FF4040;"&gt;',
                          '&lt;span style="color:#FF40FF;"&gt;',
                          '&lt;span style="color:#3F3F10;"&gt;',
                          '&lt;span style="color:#FFFFFF;"&gt;');
  return str_replace($codes, $replace, $string).'&lt;/span&gt;';
  }
  </code></pre>