I am trying to add comments when compiling a regular expression, but when using the re.VERBOSE flag, I no longer get matchresult.
(using Python 3.3.0)
Before:
regex = re.compile(r"Duke wann", re.IGNORECASE) print(regex.search("He is called: Duke WAnn.").group())
Result: Duke WAnn
After:
regex = re.compile(r''' Duke # First name Wann #Last Name ''', re.VERBOSE | re.IGNORECASE) print(regex.search("He is called: Duke WAnn.").group())`
Conclusion: AttributeError: the NoneType object does not have a group attribute
bfloriang
source share