in reply to Unable to replace targeted newlines in a string

A quantified capturing group (...)+ only stores the last match in the dollar-number variable it is associated with.

So I recommend capturing all the AAA to CCC lines in a single capture, and remove the newlines from that in a separate step. Or even simple, split on /^(?=P\d)/m and then remove newlines from the chunks.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Unable to replace targeted newlines in a string
by benchrifa (Novice) on Oct 30, 2009 at 13:32 UTC

    Thank you for your explanation: crystal clear.

    Benchrifa