in reply to Re^2: substitute instead global matching for nested matches
in thread substitute instead global matching for nested matches

The following meets your current spec as I understand it:

use strict; use warnings; my $fc = <<FC; #4 r2 ! #5 r3 ! r7 ! r10 ! #8 r0 ! r1 ! FC print "$1\n$2\n" while $fc =~ /^(#\d+)[^#]*^([^#\n]+)$/gm;

Prints:

#4 r2 ! #5 r10 ! #8 r1 !
True laziness is hard work

Replies are listed 'Best First'.
Re^4: substitute instead global matching for nested matches
by utku (Acolyte) on Mar 18, 2012 at 23:27 UTC
    It works! GrandFather, thanks for the tip about pattern matching!