in reply to Why does this simple grouping regex not match?
perl -Mre=debug -e '$_ = q!(b).!; /\((?=a|b|c)\)/ && do { print qq{mat +ch! $&\n}; };' perl -Mre=debug -e '$_ = q!(b).!; /\((?=a|b|c)/ && do { print qq{match +! $&\n}; };'
$ perl -Mre=debug -e '$_ = q!(b).!; /\((?=a|b|c)\)/ && do { print qq{m +atch! $&\n}; };' Compiling REx "\((?=a|b|c)\)" Final program: 1: EXACT <(> (3) 3: IFMATCH[0] (16) 5: TRIE-EXACT[abc] (14) <a> <b> <c> 14: SUCCEED (0) 15: TAIL (16) 16: EXACT <)> (18) 18: END (0) anchored "()" at 0 (checking anchored) minlen 2 Guessing start of match in sv for REx "\((?=a|b|c)\)" against "(b)." Did not find anchored substr "()"... Match rejected by optimizer Freeing REx: "\((?=a|b|c)\)" $ perl -Mre=debug -e '$_ = q!(b).!; /\((?=a|b|c)/ && do { print qq{mat +ch! $&\n}; };' Compiling REx "\((?=a|b|c)" Final program: 1: EXACT <(> (3) 3: IFMATCH[0] (16) 5: TRIE-EXACT[abc] (14) <a> <b> <c> 14: SUCCEED (0) 15: TAIL (16) 16: END (0) anchored "(" at 0 (checking anchored) minlen 1 Guessing start of match in sv for REx "\((?=a|b|c)" against "(b)." Found anchored substr "(" at offset 0... Guessed: match at offset 0 Matching REx "\((?=a|b|c)" against "(b)." 0 <> <(b).> | 1:EXACT <(>(3) 1 <(> <b).> | 3:IFMATCH[0](16) 1 <(> <b).> | 5: TRIE-EXACT[abc](14) 1 <(> <b).> | State: 1 Accepted: 0 Charid: + 2 CP: 62 After State: 3 2 <(b> <).> | State: 3 Accepted: 1 Charid: + 2 CP: 0 After State: 0 got 1 possible matches only one match left: #2 <b> 2 <(b> <).> | 14: SUCCEED(0) subpattern success... 1 <(> <b).> | 16:END(0) Match successful! match! ( Freeing REx: "\((?=a|b|c)"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why does this simple grouping regex not match?
by december (Pilgrim) on Mar 01, 2011 at 11:46 UTC |