<?php $sentence = "foo_foo_foo foo-foo_foo"; if (preg_match_all("/(?<![^\W_])foo(?![^\W_])/i", $sentence, $matches)) { print_r($matches[0]); } echo PHP_EOL . preg_replace("/(?<![^\W_])foo(?![^\W_])/i", "YES", $sentence);
You have javascript disabled. You will not be able to edit any code.