Regular Expressions 101

Community Patterns

find all while ignoring a set of patterns

0

Regular Expression
Python

r"
\b(?:(?!\bper)(?!\bdef).)*
"
igxm

Description

This can be changed to find all characters upto a specific pattern as well by changing the \b at the start to a simple ^.

This is useful if you want to limit your regex searches in a manner such that two pattern cases do not overlap (as regex does not currently handle overlap of cases when you chain patterns in a findall( ) using '|' . you simply preface your pattern and then add this at the end chaining any patterns you want your RegEx engine to stop at

Submitted by anonymous - 6 years ago