How can you find last match with python regular expressions

Spread the love

In this tutorial, you will learn about How to find last match with python regular expressions.

import re text="hi how are you ? " list = re.findall(r"\w+ \W+", text) print("last match:", list[len(list)-1])

Output:

last match: you ?

Ref: https://docs.python.org/3/howto/regex.html

If you have any alternative methods or procedures for same requirement, you can comment below.

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *