Ezio Melotti added the comment:

I believe this is not a bug.
As the error says a look-behind requires the pattern to have a fixed length.

In re.search(r'(?<=(a|b))(\w+)', 'abc').groups() the two possible patterns in 
the look behind are "a" and "b", both with length 1.
In re.search(r'(?<=(^|$))(\w+)', 'abc').groups() the two possible patterns in 
the look behind are "^" and "$", both with length 0.

In re.search(r'(?<=(^|a))(\w+)', 'abc').groups() the two possible patterns in 
the look behind are "^" and "a", one with length 0 and the other with length 1. 
 This is not allowed and raises an error.
Similarly, in re.search(r'(?<=(ab|a))(\w+)', 'abc').groups() the two patterns 
have length 2 and 1, and the same error is raised.

Closing as not a bug.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14069>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to