'''
re.I    忽略大小写
re.M    多行匹配,影响 ^ 和 $
re.S    使 . 匹配包括换行在内的所有字符
'''
import re

str1 = """aSDf
aSDf
asdf
asdf
"""
print(re.match("asdf", str1, re.I))
print(re.match(".*f$", str1, re.M))
print(re.match("^a.*", str1, re.S))

results matching ""

    No results matching ""