in reply to Regex troubles...

http://ideone.com/QUfuUp

Replies are listed 'Best First'.
Re^2: Regex troubles...
by LanX (Saint) on Apr 20, 2016 at 14:43 UTC
    Please use code tags when providing source here   <code>

    then please note that this regex is matching more cases because order constrains are lost!

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Re^2: Regex troubles...
by beech (Parson) on May 04, 2016 at 07:46 UTC

    Interesting this ideone if it really lets you run actual perl code, anyway, its best in the future if you also post the code here in code tags, here is the output on my machine

    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $text = 'XYYYZ'; my @source; push @{$source[$1 ? 0 : $2 ? 1 : 2]}, $& while $text =~ /(X)|(Y)|(Z)/g +; print Dumper \@source; __END__ $VAR1 = [ [ 'X' ], [ 'Y', 'Y', 'Y' ], [ 'Z' ] ];

    update: yeah wrong window, pasted the wrong ideone, fixed