H
Hartmut Camphausen
Hi all,
Assume the following REs:
# this should match B, followed by e.g. '=cc', and set $^R to 'got B':
/(B(?:=c*))(?{'got B'})/
# so should this, but match '=c*' only once, if any, and set $^R:
/(B(?:=c*)?)(?{'got B'})/
Both expressions match as expected (and set $1), BUT: the second one
does n o t set $^R as it should do.
However, if I say
/(?>(B(?:=c+)?)(?{...})/
i.e. force Perl to eat up anything it matches, $^R is correctly set.
How come?
Quite clueless, Hartmut
Assume the following REs:
# this should match B, followed by e.g. '=cc', and set $^R to 'got B':
/(B(?:=c*))(?{'got B'})/
# so should this, but match '=c*' only once, if any, and set $^R:
/(B(?:=c*)?)(?{'got B'})/
Both expressions match as expected (and set $1), BUT: the second one
does n o t set $^R as it should do.
However, if I say
/(?>(B(?:=c+)?)(?{...})/
i.e. force Perl to eat up anything it matches, $^R is correctly set.
How come?
Quite clueless, Hartmut