in reply to regex grouping

Something like this?
$_ = '1 2=3 4=5'; for my $up_to_3 (/(?:\W*\w+){1,3}/g) { print $up_to_3, "\n"; }
Update: oh, you want each grouping to start with a \w, and end with an equal sign and the number following it.
$_ = '1 2 3 2 6=7 2=4 j=384923 34 43 j 3=6'; for my $foo (/(?:\w[^=]*=\w+)/g) { print $foo, "\n"; }

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: regex grouping
by jfroebe (Parson) on Nov 02, 2005 at 19:12 UTC
    thanks! I've modified the original script to reflect your for loop :)

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1