in reply to very quick link regex

actually after doing a little more research I found that the link is MORE dynamic than I thought. I need to match anything after page.com/files\d+... until after the .jpg . No other part of the page has /files\d+ so if it finds a match, it'll always be the right one. Can someone help with this?

Replies are listed 'Best First'.
Re^2: very quick link regex
by varian (Chaplain) on Aug 03, 2007 at 07:40 UTC
    You were very close to result already.
    /(.+)+\.jpg
    In this last part of your regexp the dot-plus will match all up to the end of line. The remaining '.jpg' part will not be found and therefore the regexp never matches.

    The solution is to make the dot-plus part of the regexp less greedy, change the part above to:

    /(.+?)\.jpg
Re^2: very quick link regex
by atemon (Chaplain) on Aug 03, 2007 at 05:16 UTC

    try

    my $content2 =~ m#(www\.page\.com/files\d+/.+\.jpg)#i;
    Note: the code is NOT tested.

    Cheers !

    --VC



    There are three sides to any argument.....
    your side, my side and the right side.