Where '?=' expresses the necessary appearance of two expressions, '?!' expresses the necessary appearance of the one only if the second is not present. The syntax of this operator is similar to its positive counterpart:
When expression A is found, Python queries for expression B to follow it. If expression B is not found, the regex is said to match, and the hit is returned.
expression A (?!expression B)
Back to the main index of this glossary