Python多行正则表达式不匹配

时间:2021-01-12 19:54:18

标签: python regex

在以下代码段中,为什么 re.match 返回 None?以及如何正确匹配包含 {pattern} 的行?

import re

txt = \
"""
begin
  {pattern}
end
"""

print(re.match(r'^( *)\{pattern\}', txt, re.MULTILINE))

0 个答案:

没有答案
相关问题