I want to match the last occurrence of a simple pattern in a string, e.g.
list = re.findall(r"w+ AAAA w+", "foo bar AAAA foo2 AAAA bar2")
print "last match: ", list[len(list)-1]
However, if the string is very long, a huge list of matches is generated. Is there a more direct way to match the second occurrence of " AAAA ", or should I use this workaround?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…