#!/usr/bin/perl -- use Data::Dump ; use 5.010; use re 'debug'; $_=1234; m{ (?
(?&V)) # match (?&V)) # match (?&V)) # match (?&V)) # match .) # match
and save to $+{Q}
# this can be saved in $v_definition = qr//
(?(DEFINE)
(?
.) "...
synthetic stclass "ANYOF{i}[\x00-\x09\x0b-\xff][{non-utf8-latin1-all}{unicode_all}]".
Final program:
1: OPEN1 'P' (3)
3: GOSUB3[+14] (6)
6: CLOSE1 'P' (8)
8: OPEN2 'Q' (10)
10: REG_ANY (11)
11: CLOSE2 'Q' (13)
13: DEFINEP (15)
15: IFTHEN (27)
17: OPEN3 'V' (19)
19: REG_ANY (20)
20: REG_ANY (21)
21: REG_ANY (22)
22: CLOSE3 'V' (27)
24: LONGJMP (26)
26: TAIL (27)
27: END (0)
stclass ANYOF{i}[\x00-\x09\x0b-\xff][{non-utf8-latin1-all}{unicode_all}] minlen 4
Matching REx "%n (?
.) "... against "1234"
Matching stclass ANYOF{i}[\x00-\x09\x0b-\xff][{non-utf8-latin1-all}{unicode_all}] against "1" (1 bytes)
0 <> <1234> | 1:OPEN1 'P'(3)
0 <> <1234> | 3:GOSUB3[+14](6)
0 <> <1234> | 17: OPEN3 'V'(19)
0 <> <1234> | 19: REG_ANY(20)
1 <1> <234> | 20: REG_ANY(21)
2 <12> <34> | 21: REG_ANY(22)
3 <123> <4> | 22: CLOSE3 'V'(27)
EVAL trying tail ... 0
3 <123> <4> | 6: CLOSE1 'P'(8)
3 <123> <4> | 8: OPEN2 'Q'(10)
3 <123> <4> | 10: REG_ANY(11)
4 <1234> <> | 11: CLOSE2 'Q'(13)
4 <1234> <> | 13: DEFINEP(15)
4 <1234> <> | 15: IFTHEN(27)
4 <1234> <> | 27: END(0)
Match successful!
{
# tied Tie::Hash::NamedCapture
P => 123,
Q => 4,
}
Freeing REx: "%n (?
.) "...