[issue18647] re.error: nothing to repeat

Tim Peters report at bugs.python.org
Sun Aug 4 21:34:49 CEST 2013


Tim Peters added the comment:

I'm afraid it's just too tricky for the code to deduce that a negative lookahead assertion can imply that a later match can't be empty.  But I don't know how smart the re compilation code already is ;-)

It occurs to me now that the doctest regexp could worm around this very easily, via replacing:

.*$\n?

with:

.+$\n?

The success of the negative lookahead assertion here doesn't _just_ imply that


.*$\n?

will match a non-empty string, it also implies that

.+$

will succeed (and so also that .+$\n? will succeed).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18647>
_______________________________________


More information about the Python-bugs-list mailing list