New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Comparing regexps #44856
Comments
It would be very nice with a function in the re module to compare two regular expressions and see how they overlap. |
Can this be done in the existing implementation by comparing the racetrack diagrams (character transitions)? Thomas, do you know of anywhere this have been done (third-party modules or in other languages)? |
I found this page with the function to do so: http://terpstra.ca/compare.html I also found this thread: http://bumppo.net/lists/fun-with-perl/1999/09/msg00000.html which discusses how to do this with some canonical formed expressions. A function like this would really be able to speed some applications up, which matches a lot of strings with a number of expressions. If you know which ones are disjoint, you can break the test when one test matches. |
I talked with the guy who wrote the ZZ comparator. """I can give you the source code under the GPL if you like. However, I It's available at svn://mlton.org/mltonlib/trunk/ca/terpstra/regexp. I don't know any SML though. """1. Parse the regular expression (in GNU regular expression syntax) For comparing regular expressions I take the following additional It could be cool. |
Am closing the feature request because it has very little chance of making it into the core distribution without being a third-party module first. The existing implementation is already somewhat difficult to maintain and we don't want to make that worse. Also, the new functionality is of interest to only a small subset of the re module users. If you do write it, respect the GPL license on the SML code and take some care to make sure you can license your new code in any way you see fit. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: