So I have this regex:
(^(\\s+)?(?P(\\w)(\\d{7}))((01f\\.foo)|(\\.bar|\\.goo\\.moo\\.roo))$|(^(\\s+)?(?PR1_\\d{6}_\\d{6}_)((01f\\.foo)|(\
The following answer deals with how to make the above regex work in Python3.
Since the re2 module as suggested by Max would not work in Python3, because of the
NameError: basestring
. Another alternative to this is the regex
module.
regex
module is just an enhanced version of re
with extra added features. This
module also allows to have same group names in the regex.
You can install it via:
sudo pip install regex
And if you have already been using re
or re2
in your program. Just do the following to import regex
module
import regex as re