I want to match some sub strings in an url.
Eg url's :-
www.google.com/images
www.google.com/images.pdf
Currently I have the re = r"([^.]*$)"
This works for case 1 as intended but fails for 2.
www.google.com/images.pdf
matches .pdf
-> Working as intended
www.google.com/images
matches .com/images
-> Failing
I want the re to not match when it cannot find a .
and finds the first /
from the end.
Please don't suggest doing this with .endswith
. I don't have the list of all possible extensions that I need to match.