Author reuven
Recipients ezio.melotti, mrabarnett, reuven
Date 2020-11-26.07:09:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606374594.43.0.361161161946.issue42469@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-11-26 07:09:54reuvensetrecipients: + reuven, ezio.melotti, mrabarnett
2020-11-26 07:09:54reuvensetmessageid: <1606374594.43.0.361161161946.issue42469@roundup.psfhosted.org>
2020-11-26 07:09:54reuvenlinkissue42469 messages
2020-11-26 07:09:54reuvencreate