I read that you should use ?
to match text non-greedily, so the regex
http://.*?\.png
...used on
http://example.png.png
...would return http://example.png
.
But the non-greediness only seems to work from left to right. That is, if I matched it on
http://http://example.png
...it would return http://http://example.png
.
How can I get the code to match http://example.png
only?