title: Preg Replace only numbers and/or numbers with percentages
body: <p>What I basically want is to replace all numbers and/or numbers with percentages, but use the matches to wrap inside a class. I don't want to do this with javascript.</p>
  
  <p>So this is the string I have;</p>
  
  <pre><code>$string = 'Call a group of 8 Shadow Beasts to plummet from the sky at a targeted location dealing 3200% total weapon damage over 5 seconds and stunning enemies hit for 2 seconds.'
  </code></pre>
  
  <p>And here is an example of what I want to achieve;</p>
  
  <pre><code>$string = 'Call a group of &lt;span class="d3-color-green"&gt;8&lt;/span&gt; Shadow Beasts to plummet from the sky at a targeted location dealing &lt;span class="d3-color-green"&gt;3200%&lt;/span&gt; total weapon damage over &lt;span class="d3-color-green"&gt;5&lt;/span&gt; seconds and stunning enemies hit for &lt;span class="d3-color-green"&gt;2&lt;/span&gt; seconds.'
  </code></pre>
  
  <p>This is how I'm trying to do this;</p>
  
  <pre><code>preg_replace("/[0-9]*%/", '&lt;span class="d3-text-green"&gt;$1&lt;/span&gt;', $string);
  </code></pre>
  
  <p>The only problem is, this removes the numbers and percentages and replaces this with the class. Am I in the right way or completely off?</p>