How can negative look-ahead assertions be used to improve the accuracy of preg_match_all() in PHP?

Negative look-ahead assertions can be used in preg_match_all() to exclude certain patterns from being matched. This can improve the accuracy of the function by allowing you to specify patterns that should not be included in the results. By using negative look-ahead assertions, you can filter out unwanted matches and ensure that only the desired patterns are returned.

$string = "The quick brown fox jumps over the lazy dog.";
preg_match_all('/\b\w+(?!\sfox)\b/', $string, $matches);
print_r($matches[0]);