in reply to why my reg ex matches greedy?

Inperl:

You can't just make up syntax and expect perl to know what you want. Read perlre, then read it a couple more times, then you should be able to figure out how to tell perl what you're looking for.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: why my reg ex matches greedy?
by Anonymous Monk on Jun 25, 2012 at 20:56 UTC

    i did not make my own syntax and expect perl to understand it. it is just that i do not know what i was doing wrong over there and trying to seek help.

      Well, clearly I'm an idiot. I thought I'd drop a mention of YAPE::Regex::Explain to show how to figure out what a regular expression is saying, so I could point out the "invented" bit. But I find that the bit I thought was "invented" seems fine. Sorry about that. When I run:

      use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/(.*)(_\d{11,}?.*)(\.\w+)/)->explain +();

      I get:

      And I thought the \d{11,}? was the invented bit. I'll have to play with that sometime.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

        And I thought the \d{11,}? was the invented bit. I'll have to play with that sometime.

        You should, the future of all new perl regex features rests upon that syntax