Message 172696 - Python tracker (original) (raw)

+1. Note that this really can't be done in user-level code. For example, consider matching the pattern

a|ab

against the string

ab

Without being forced to consider the "ab" branch, the regexp will match just the "a" branch. So, e.g., the example code you posted will say "nope, it didn't match (the whole thing)".