New submission from Roy Smith: >>> re.compile('(?P=<foo>)') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/roy/env/python/lib/python2.7/re.py", line 190, in compile return _compile(pattern, flags) File "/home/roy/env/python/lib/python2.7/re.py", line 242, in _compile raise error, v # invalid expression sre_constants.error: bad character in group name
The error here is that I put a "=" where it shouldn't be. The error message is misleading. The "group name" is the stuff between the <>'s. That part's fine. What's broken is the stuff outside of the <>'s. Unclear if it's reasonable to expect such precise error reporting here, but this one seems particularly misleading, so opening a ticket to record the observation. ---------- components: Regular Expressions messages: 183375 nosy: ezio.melotti, mrabarnett, roysmith priority: normal severity: normal status: open title: Poor error message when compiling invalid regex type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17341> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com