I want to reverse a regular expression. I.e. given a regular expression, I want to produce any string that will match that regex.
I know how to do this from a theoretical computer science background using a finite state machine, but I just want to know if someone has already written a library to do this. :)
I'm using Python, so I'd like a Python library.
To reiterate, I only want one string that will match the regex. Things like "." or ".*" would make an infinite amount of strings match the regex, but I don't care about all options.
I'm willing for this library to only work on a certain subset of regex.
question from:
https://stackoverflow.com/questions/492716/reversing-a-regular-expression-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…