leftmost longest match (of disjunctions) ; greediness of "|"
Joerg Schuster
js at cis.uni-muenchen.de
Tue Dec 2 09:18:04 EST 2003
"Fredrik Lundh" <fredrik at pythonware.com> writes:
> Joerg Schuster wrote:
>
> > I should have read your mail more carefully. You wrote about sorting
> > the *re*, not about sorting the regex. Sorry.
>
> what's the difference?
One could suspect that re.search() first matches with a greedy "|", then
stores all the matches of all parts of the disjunction in the
re-object and then returns the first one.
Jörg
More information about the Python-list
mailing list