Борис Верховский <boris.v...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38660>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to