my $str = 'bxAybz';
while ( $str =~ /(?(?{1})(b[xyz]))/g ) {
say 'yes';
say $1;
}
--output:--
yes
bx
yes
bz
####
my $str = 'bxAybz';
while ( $str =~ /(?(?{pos() % 2 == 0})(b[xyz]))/g ) {
say 'yes';
say $1;
}
--output:--
yes
bx
yes
Use of uninitialized value $1 in say at 2.pl line 9.
yes
bz
##
##
my $str = 'bxAybz';
while ( $str =~ /
(?
(?{1})
(b[xyz])
)
/gx ) {
say 'yes';
say $1;
}
--output:--
Sequence (?
...) not recognized in regex; marked by <-- HERE in m/
(?
<-- HERE (?{1})
(b[xyz])
)
/ at 2.pl line 12.