正则表达式
^ 行首匹配
$ 行尾匹配
\A 匹配字符串的开始,与^ 区别即使在re.M的模式下,也不匹配其他行的行首
\Z 匹配字符串的结束,与$区别即使在re.M的模式下,也不匹配其他行的行首
\b 匹配一个单词的边界, 写左边匹配左边界,写在右边匹配右边界,
写在两边匹配整个单词
\B 匹配非单词的边界,写左边左边界不匹配,写在右边右边界不匹配,
写在两边,两边的边界不匹配。
flags = re.M多行匹配
print(re.findall(r"12","1234512341234"))
print(re.findall(r"^12$","345\n12341234"))
print(re.findall(r"12$","12\n12",flags=re.M))
print(re.findall(r"12\Z","12\n12",flags=re.M))
print(re.findall(r"er\b","erner erver"))
print(re.findall(r"\ber","erner erver"))
print(re.findall(r"\ber\b","erner erver er"))
print(re.findall(r"er\B","erner erver"))
print(re.findall(r"\Ber","erner erver"))
print(re.findall(r"\Ber\B","ernerr erver er"))
print(re.search("\Agood","you are a good man",re.M))