我想匹配字符串中最后一个简单模式的出现,例如
list = re.findall(r"\w+ AAAA \w+", "foo bar AAAA foo2 AAAA bar2") print "last match: ", list[len(list)-1]
但是,如果字符串很长,则会生成大量匹配项.是否有更直接的方法来匹配"AAAA"的第二次出现或我应该使用此变通方法?
python regex
python ×1
regex ×1