By the way, I know that the Regexp::Debugger package is available through CPAN (and very cool), but I have no way to get any similar traces from it; I don’t want to gradually complete a large number of Steps.
use re'debug';
my $str = "abcdefg";
$str =~ m/[ef]+/;
This gives an output:
Compiling REx "[ef]+"
Final program :
1: PLUS (13)
2: ANYOF[ef] (0)
13: END (0)
stclass ANYOF[ef] plus minlen 1
Matching REx "[ef]+" against "abcdefg"
Matching stclass ANYOF[ef] against "abcdefg" (7 bytes)
4| 1:PLUS(13)
ANYOF[ef] can match 2 times out of 2147483647...
6| 13: END(0)
Match successful!
Freeing REx: "[ ef]+"
Is there a convenient way to get the status of the regular expression engine when evaluating m // or s /// expressions?
By the way, I know that the Regexp::Debugger package is available through CPAN (and very cool), but I have no way to get any similar traces from it; I don’t want to gradually complete a large number of Steps.
Yes. Turn the regular expression engine into debug mode, and it will print what it is doing:
use re'debug';
my $str = "abcdefg";
$str =~ m/[ef]+/;
This gives an output:
Compiling REx "[ef]+"
Final program:
1: PLUS (13)< br /> 2: ANYOF[ef] (0)
13: END (0)
stclass ANYOF[ef] plus minlen 1
Matching REx "[ef]+" against "abcdefg"
Matching stclass ANYOF[ef] against "abcdefg" (7 bytes)
4| 1:PLUS(13)
ANYOF[ef] can match 2 times out of 2147483647...
6| 13: END(0)
Match successful!
Freeing REx: "[ef]+"