I have a list of regular expressions from which I want to extract those that are equivalent to string comparisons.
For example, these regular expressions are equivalent to simply matching strings:
[r"example",
r"foo\.bar"]
while these regular expressions are not:
[r"e.ample",
r"foo\\.bar"]
According to https://docs.python.org/2/howto/regex.html , a list of valid metacharacters is . ^ $ * + ? { } [ ] \ | ( ).
I am going to create a regex, but it looks a little more complicated. I am wondering if there is a shortcut when exploring an object reor something like that.
source
share