fork download
  1. <?php
  2. $s = preg_replace('/^.*?(\d+(?=\D*$)\s*)/', '', 'Foo Oz');
  3.  
  4. $s = preg_replace('/^.*?(\d+(?=\D*$)\s*)/', '', '1/2 Oz');
  5.  
  6. $s = preg_replace('/^.*?(\d+(?=\D*$)\s*)/', '', '2 3/4 Oz');
  7. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
string(6) "Foo Oz"
string(2) "Oz"
string(2) "Oz"