in reply to Re^2: Efficient method to replace middle lines only when no match
in thread Efficient method to replace middle lines only when no match
$has_field2 =~ s/field1:[\n]*\n\K(?!field2:).*(?=\nfield3:) /field2: valueB /msx;
c:\@Work\Perl\monks\Zu>perl -wMstrict -le "my $s = 'xxxyxxx'; $s =~ s/y /FOO /xms; print qq{'$s'}; " 'xxxFOO xxx'
|
|---|