fork download
  1. <?php
  2.  
  3. $re = "/^(?!.*love).*fruit/";
  4. if (preg_match($re, "We all love green fruit."))
  5. {
  6. echo "Found in 'We all love green fruit.'\n";
  7. } else {
  8. echo "Not found in'We all love green fruit.'\n";
  9. }
  10. if (preg_match($re, "We all love to walk."))
  11. {
  12. echo "Found in 'We all love to walk.'\n";
  13. } else {
  14. echo "Not found in 'We all love to walk.'\n";
  15. }
  16. if (preg_match($re, "We all green fruit."))
  17. {
  18. echo "Found in 'We all green fruit.'";
  19. } else {
  20. echo "Not found in 'We all green fruit.'";
  21. }
  22.  
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Not found in'We all love green fruit.'
Not found in 'We all love to walk.'
Found in 'We all green fruit.'