Let's consider the variable pattern = re.compile(r"\w+"). Is there a way to retreive the string r"\w+" used to define pattern ?
2 Answers
Well, if we look at the docs, we see that regex objects have the attribute:
regex.patternThe pattern string from which the RE object was compiled.