fork download
  1. <?php
  2.  
  3. $str = 'This is a number 100 but this isn\'t $100.';
  4. $re = '~\s*(?<!\$)\b\d+~';
  5. $subst = '!';
  6. $result = preg_replace($re, $subst, $str);
  7. echo $result;
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
This is a number! but this isn't $100.