如何使用正则表达式匹配python中字符串的结尾?

以下代码在字符串“足球场上的啦啦队长”末尾匹配“体育场”一词

$-匹配字符串的结尾

示例

import re
s = 'cheer leaders at the football stadium'
result = re.search(r'\w+$', s)
print result.group()

输出结果

这给出了输出

stadium