What is the purpose of using negative lookbehind in a regex pattern in PHP?

Negative lookbehind in a regex pattern in PHP is used to match a pattern only if it is not preceded by another specific pattern. This can be useful when you want to find a specific string but only if it is not preceded by certain characters or strings. Example:

$text = "The quick brown fox jumps over the lazy dog";

// Match 'fox' only if it is not preceded by 'quick'
if (preg_match('/(?<!quick )fox/', $text, $matches)) {
    echo "Match found: " . $matches[0];
} else {
    echo "No match found";
}