fork download
  1. <?php
  2.  
  3. $string = "123"; //or one of the other examples
  4. if (preg_match("/(?<!\d)$string(?!\d)/", "123123",$matches)) {
  5. echo "Matched!";
  6. } else {
  7. echo "Not matched!";
  8. }
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Not matched!