my $string = 'bet';
use re qw(debug);
my $rx1 = qr/b(?:a|e)t/;
$string =~ /$rx1/;
my $rx2 = qr/b[ae]t/;
$string =~ /$rx2/;
####
Compiling REx `b(?:a|e)t'
size 12 Got 100 bytes for offset annotations.
first at 1
1: EXACT (3)
3: BRANCH(6)
4: EXACT (10)
6: BRANCH(9)
7: EXACT (10)
9: TAIL(10)
10: EXACT (12)
12: END(0)
anchored "b" at 0 (checking anchored) minlen 3
Offsets: [12]
1[1] 0[0] 4[1] 5[1] 0[0] 6[1] 7[1] 0[0] 7[0] 9[1] 0[0] 10[0]
Guessing start of match, REx "b(?:a|e)t" against "bet"...
Found anchored substr "b" at offset 0...
Guessed: match at offset 0
Matching REx "b(?:a|e)t" against "bet"
Setting an EVAL scope, savestack=7
0 <> | 1: EXACT
1 | 3: BRANCH
Setting an EVAL scope, savestack=13
1 | 4: EXACT
failed...
1 | 7: EXACT
2 | 10: EXACT
3 <> | 12: END
Match successful!
##
##
Compiling REx `b[ae]t'
size 16 Got 132 bytes for offset annotations.
first at 1
1: EXACT (3)
3: ANYOF[ae](14)
14: EXACT (16)
16: END(0)
anchored "b" at 0 (checking anchored) minlen 3
Offsets: [16]
1[1] 0[0] 2[4] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 6[1] 0[0] 7[0]
Guessing start of match, REx "b[ae]t" against "bet"...
Found anchored substr "b" at offset 0...
Guessed: match at offset 0
Matching REx "b[ae]t" against "bet"
Setting an EVAL scope, savestack=9
0 <> | 1: EXACT
1 | 3: ANYOF[ae]
2 | 14: EXACT
3 <> | 16: END
Match successful!
Freeing REx: `"b(?:a|e)t"'
Freeing REx: `"b[ae]t"'
##
##
Compiling REx "b(?:a|e)t"
Final program:
1: EXACT (3)
3: TRIE-EXACT[ae] (10)
10: EXACT (12)
12: END (0)
anchored "b" at 0 (checking anchored) minlen 3
Guessing start of match in sv for REx "b(?:a|e)t" against "bet"
Found anchored substr "b" at offset 0...
Guessed: match at offset 0
Matching REx "b(?:a|e)t" against "bet"
0 <> | 1:EXACT (3)
1 | 3:TRIE-EXACT[ae](10)
1 | State: 1 Accepted: 0 Charid: 2 CP: 65 After State: 3
2 | State: 3 Accepted: 1 Charid: 2 CP: 0 After State: 0
got 1 possible matches
only one match left: #2
2 | 10:EXACT (12)
3 <> | 12:END(0)
Match successful!
Freeing REx: "b(?:a|e)t"