in reply to Regex becomes greedy with /s

It's not that the .+? becomes greedy, it's that /s allows dot to match newlines. Thus, the leftmost match can start earlier. Maybe you want to use HTML::LinkExtor or an HTML parser, or maybe even Web::Scraper, or even HTML::Selector::XPath

Replies are listed 'Best First'.
Re^2: Regex becomes greedy with /s
by pingo (Hermit) on Feb 26, 2010 at 10:24 UTC
    Ah... I think I understand.

    And this is just a throwaway script I am working on (at least I am fairly sure it is ;-)). If it was something more permanent, I'd certainly use one of the modules you mention.

      Another argument for TheDamian's PBP regex recommendation that a standard set of regex modifiers be used, even in 'throwaway' scripts. E.g.,
          m{pattern}xms