New submission from Reuven Lerner <reu...@lerner.co.il>:
I just discovered that having whitespace inside of {min,max} causes the regexp to report no matches, rather than an error: >>> import re >>> s = 'abbcccddddeeeee' >>> re.findall('d{1, 4}', s) [] >>> re.findall('d{1,4}', s) ['dddd'] Ruby and JavaScript have the same behavior, so maybe this is standard in some way. But I find it hard to believe that it's desirable. (My post on Twitter about this confirmed that a whole lot of people were bitten by this bug in the past.) BSD grep, GNU grep, and GNU Emacs all raise an error upon encountering this whitespace, which strikes me as less surprising and more useful behavior. ---------- components: Regular Expressions messages: 381879 nosy: ezio.melotti, mrabarnett, reuven priority: normal severity: normal status: open title: Space in re's {min,max} should raise an error, rather than fail silently versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42469> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com