1. Computing

Python Regular Expressions (regex): Regex Negation ('(?!)')

By

Definition:

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:


expression A (?!expression B)
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.


Back to the main index of this glossary
  1. About.com
  2. Computing
  3. Python
  4. Regular Expressions
  5. Python RegEx Glossary
  6. Parenthetical Compounds
  7. Python Regular Expressions (regex): Regex Negation ('(?!)')

©2014 About.com. All rights reserved.