I would like to match the last occurrence of a pattern using regular expressions.
I have text structured like this:
Pellentesque habitant morbi tristique senectus et netus et lesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas <br>semper<br>tizi ouzou<br>Tizi Ouzou<br>
I want to match the last text between two <br> in my case <br>Tizi Ouzou<br> , ideally Tizi Ouzou string
Please note that there are some spaces after the last <br>
I tried this:
<br>.*<br>\s*$
but he chooses everything from the first <br> to the last.
NB: I'm on python and I use pythex to test my regex
python regex
Ghilas belhadj
source share