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 boris
Recipients ammar2, boris, ezio.melotti, mrabarnett, serhiy.storchaka
Date 2019-11-01.08:16:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572596200.39.0.539233725219.issue38660@roundup.psfhosted.org>
In-reply-to
Content
I saw two Python regexes, one derived from a regex in the standard library. There was a comment saying that they're interchangeable and I wanted to check if they were actually the same without having to read what all the regex symbols mean. Plus a true comparison would be more correct.

Besides that I don't have a real use case. There's a few people asking about doing this if you Google for "check if two regexes are equivalent". Some for Python specifically.

@serhiy I read what \w meant from the first Google result and got it wrong. Sounds like a good argument for why Python should be able to do this for me :)

Regexes are not Turing complete, so not quite. If I understand it correctly, comparing them is somewhere between comparing two graphs and comparing two programs (which is generally impossible). Theoretically it's a decidable problem, but the extra logic that Python's implementation has (for dealing with unicode and whatever) makes it hard, but it should still be theoretically possible, unless Python's regexes are somehow Turing complete.
History
Date User Action Args
2019-11-01 08:16:40borissetrecipients: + boris, ezio.melotti, mrabarnett, serhiy.storchaka, ammar2
2019-11-01 08:16:40borissetmessageid: <1572596200.39.0.539233725219.issue38660@roundup.psfhosted.org>
2019-11-01 08:16:40borislinkissue38660 messages
2019-11-01 08:16:39boriscreate