in reply to Re: Greedy flip flop operator?
in thread Greedy flip flop operator?

> /^\[^\+]/

Shouldn't it rather be  /^[^+]/ ?

I'd also test for following \w+ to avoid whitespace confusion.

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

Replies are listed 'Best First'.
Re^3: Greedy flip flop operator?
by Discipulus (Canon) on Apr 26, 2018 at 07:36 UTC
    /^[^+]/ will end at the first empty line (if they really are there as shown).. anyway you are right: I must not post before coffe

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      > will end at the first empty line

      Really? Can't test at the moment but an empty line shouldn't match a character class cause it requires at least one character.

      Of course you could have whitespace characters, that's why I'd include \w+

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

Re^3: Greedy flip flop operator?
by chengchl (Acolyte) on Apr 26, 2018 at 07:56 UTC
    Hi Rolf, It seems it will only print the first line... When i execute the code as you instructed.