How to match the last url in a line containing multiple urls, using regular expressions?

Posted by Mert Nuhoglu on Stack Overflow See other posts from Stack Overflow or by Mert Nuhoglu
Published on 2010-06-13T12:24:55Z Indexed on 2010/06/13 12:32 UTC
Read the original article Hit count: 264

Filed under:
|
|

I want to write a regex that matches a url that ends with ".mp4" given that there are multiple urls in a line.

For example, for the following line:

"http://www.link.org/1610.jpg","Debt","http://www.archive.org/610_.mp4","66196517"

Using the following pattern matches from the first http until mp4.

(http:\/\/[^"].*?\.mp4)[",].*?

How can I make it match only the last url only?

Note that, the lines may contain any number of urls and anything in between. But only the last url contains .mp4 ending.

© Stack Overflow or respective owner

Related posts about regex

Related posts about url