Variable-width lookbehind
OKB (not okblacke)
brenNOSPAMbarn at NObrenSPAMbarn.net
Sat Nov 17 20:39:39 EST 2007
Paul Rubin wrote:
> "OKB (not okblacke)" <brenNOSPAMbarn at NObrenSPAMbarn.net> writes:
>> For years now Python has not supported variable-length
>> lookbehinds.
>
> I'm not sure what that is and the perl links you gave don't work,
> but it sounds evil.
The links work fine for me. . .
You're not sure what "variable-length lookbehinds" means?
Lookbehind is something that Python regexps already have. You can do
"(?<=one)two" to match "two" only if it's preceded by "one", and you can
do "(?<!one)two" to match "two" only if it's NOT preceded by "one".
What you can't do is "(?<=one|three)two", because Python requires that
the lookbehind contain only strings of a fixed length. What I'm asking
about is the possibility of lifting this limitation, to allow the
lookbehinds (positive and negative) to contain general regexps. I don't
see how this is in any way evil.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
More information about the Python-list
mailing list