This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Davidebyzero
Recipients Davidebyzero, ezio.melotti, mrabarnett
Date 2021-04-04.07:52:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617522721.12.0.340315705312.issue43726@roundup.psfhosted.org>
In-reply-to
Content
The regex /^((x*)\2{3}(?=\2$))*x$/ matches powers of 5 in unary, expressed as strings of "x" characters whose length is the number.

The following command line should print "1", but prints nothing:
python -c 'import regex; regex.match(r"^((x*)\2{3}(?=\2$))*x$", "x"*125) and print(1)'

However, this command does print "1":
python -c 'import regex; regex.match(r"^((x*)\2\2\2(?=\2$))*x$", "x"*125) and print(1)'

And so does this one:
python -c 'import re; re.match(r"^((x*)\2{3}(?=\2$))*x$", "x"*125) and print(1)'

The expression "\2\2\2" should behave exactly the same as "\2{3}", but in the "regex" module it does not.

Solving the following Code Golf Stack Exchange challenge is what led me to discover this bug:
https://codegolf.stackexchange.com/questions/211840/is-that-number-a-two-bit-number%ef%b8%8f/222792#222792
History
Date User Action Args
2021-04-04 07:52:01Davidebyzerosetrecipients: + Davidebyzero, ezio.melotti, mrabarnett
2021-04-04 07:52:01Davidebyzerosetmessageid: <1617522721.12.0.340315705312.issue43726@roundup.psfhosted.org>
2021-04-04 07:52:01Davidebyzerolinkissue43726 messages
2021-04-04 07:52:00Davidebyzerocreate