正規表現をコンパイルするときにコメントを入れようとしていますが、re.VERBOSE フラグを使用すると、もう matchresult が得られません。
(Python 3.3.0 を使用)
前:
regex = re.compile(r"Duke wann", re.IGNORECASE)
print(regex.search("He is called: Duke WAnn.").group())
出力: デューク ワン
後:
regex = re.compile(r'''
Duke # First name
Wann #Last Name
''', re.VERBOSE | re.IGNORECASE)
print(regex.search("He is called: Duke WAnn.").group())`
出力: AttributeError: 'NoneType' オブジェクトに属性 'group' がありません