title: How can I extract the number before "PS" (case-insensitive)?
body: <p>I've a string which can look something like this:</p>
  
  <pre><code>)250 W (501 PS
  20 ps
  50 ps
  LPG)                                  246 kW (334 PS
  </code></pre>
  
  <p>I want to get <code>501, 20, 50 and 334</code> respectively.
  In other words: The <code>digit</code> just before <code>PS</code> OR <code>ps</code>(case insensitive).</p>
  
  <p>I tired this, but doesn't work for all cases as shown above:</p>
  
  <pre><code>$str = 'LPG)                                  246 kW (334 PS';
  preg_match('/\d+(.*?)PS/',$str, $m);
  print_r($m);
  </code></pre>
  
  <p>How can I change my code to work for every possible string as shown above?</p>