in reply to Re: Must do regex range quantifier { } as a greedy
in thread Must do regex range quantifier { } as a greedy

Your elegant solution won't match the edge case of aa, but it's unclear to me whether that is relevant for the OP.

Replies are listed 'Best First'.
Re^3: Must do regex range quantifier { } as a greedy
by LanX (Saint) on Jan 17, 2022 at 10:14 UTC
    > won't match the edge case of aa

    hmm ... works for me

    DB<24> say 'aa' =~ /aa(?!a)b{0,2}/; say "<$&>" 1 <aa>

    or did you mean something else?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Aaah - I got tripped up by my own test harness. Yes, once I use your regular expression, it works for me as well.