2.8 多行匹配模式
问题
解决方案
>>> text2 = '''/* this is a
... multiline comment */
... '''>>> comment = re.compile(r'/\*((?:.|\n)*?)\*/')
>>> comment.findall(text2)
[' this is a\n multiline comment ']讨论
>>> comment = re.compile(r'/\*(.*?)\*/', re.DOTALL)Last updated