fork download
  1. <?php
  2.  
  3. $s = "abc 123 and 4";
  4. $res = preg_replace('~\D+~', '', $s);
  5. echo $res;
Success #stdin #stdout 0s 82944KB
stdin
Standard input is empty
stdout
1234