title: Regular expression for matching quantities and unit
body: <p>I need to extract the quantity and unit from strings like this </p>
  
  <pre><code>1 tbsp
  1tbsp 
  300ml
  300 ml
  10grams
  10 g
  </code></pre>
  
  <p>The quantities will always be numbers, then there may or may not be a space then the unit. They may be 15 - 20 different units which can come from a list that we define (perhaps an array)</p>
  
  <p>The solution can be in either javascript or PHP as I need to split them before storing them in a database. ie they need to be stored separately.</p>
  
  <p>Thanks</p>
  
  <p>EDIT: Sorry to be clear. Each new line represents a new string. That is the string would only contain 10g OR 300ml - so we just need to split one unit and one quantity at a time. </p>