title: Regex to find integers and decimals in string
body: <p>I have a string like:</p>
  
  <pre><code>$str1 = "12 ounces";
  $str2 = "1.5 ounces chopped;
  </code></pre>
  
  <p>I'd like to get the amount from the string whether it is a decimal or not (12 or 1.5), and then grab the immediately preceding measurement (ounces).</p>
  
  <p>I was able to use a pretty rudimentary regex to grab the measurement, but getting the decimal/integer has been giving me problems.</p>
  
  <p>Thanks for your help!</p>