use re 'debug';
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)"

In reply to Re: Why does this simple grouping regex not match? by Anonymous Monk
in thread Why does this simple grouping regex not match? by december

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.