Interesting. I just noticed (|f+) behaves the same.

Running a simplified code with use re 'debug' gives the answer:

use re 'debug'; $s = 'xfx'; while ($s =~ / (f*?) /gx) {

Compiling REx " (f*?) " Final program: 1: OPEN1 (3) 3: MINMOD (4) 4: STAR (7) 5: EXACT <f> (0) 7: CLOSE1 (9) 9: END (0) minlen 0 xfx ------------ Matching REx " (f*?) " against "xfx" 0 <> <xfx> | 1:OPEN1(3) 0 <> <xfx> | 3:MINMOD(4) 0 <> <xfx> | 4:STAR(7) 0 <> <xfx> | 7: CLOSE1(9) 0 <> <xfx> | 9: END(0) Match successful! matched (f*?) of "", starting at offset of 0, ending at pos of 0 Matching REx " (f*?) " against "xfx" 0 <> <xfx> | 1:OPEN1(3) 0 <> <xfx> | 3:MINMOD(4) 0 <> <xfx> | 4:STAR(7) 0 <> <xfx> | 7: CLOSE1(9) 0 <> <xfx> | 9: END(0) Match possible, but length=0 is smaller than requested=1, failing! EXACT <f> can match 0 times out of 1 +... failed... 1 <x> <fx> | 1:OPEN1(3) 1 <x> <fx> | 3:MINMOD(4) 1 <x> <fx> | 4:STAR(7) 1 <x> <fx> | 7: CLOSE1(9) 1 <x> <fx> | 9: END(0) Match successful! matched (f*?) of "", starting at offset of 1, ending at pos of 1 Matching REx " (f*?) " against "fx" 1 <x> <fx> | 1:OPEN1(3) 1 <x> <fx> | 3:MINMOD(4) 1 <x> <fx> | 4:STAR(7) 1 <x> <fx> | 7: CLOSE1(9) 1 <x> <fx> | 9: END(0) Match possible, but length=0 is smaller than requested=1, failing! EXACT <f> can match 1 times out of 1 +... 2 <xf> <x> | 7: CLOSE1(9) 2 <xf> <x> | 9: END(0) Match successful! matched (f*?) of "f", starting at offset of 1, ending at pos of 2 Matching REx " (f*?) " against "x" 2 <xf> <x> | 1:OPEN1(3) 2 <xf> <x> | 3:MINMOD(4) 2 <xf> <x> | 4:STAR(7) 2 <xf> <x> | 7: CLOSE1(9) 2 <xf> <x> | 9: END(0) Match successful! matched (f*?) of "", starting at offset of 2, ending at pos of 2 Matching REx " (f*?) " against "x" 2 <xf> <x> | 1:OPEN1(3) 2 <xf> <x> | 3:MINMOD(4) 2 <xf> <x> | 4:STAR(7) 2 <xf> <x> | 7: CLOSE1(9) 2 <xf> <x> | 9: END(0) Match possible, but length=0 is smaller than requested=1, failing! EXACT <f> can match 0 times out of 1 +... failed... 3 <xfx> <> | 1:OPEN1(3) 3 <xfx> <> | 3:MINMOD(4) 3 <xfx> <> | 4:STAR(7) 3 <xfx> <> | 7: CLOSE1(9) 3 <xfx> <> | 9: END(0) Match successful! matched (f*?) of "", starting at offset of 3, ending at pos of 3 Matching REx " (f*?) " against "" 3 <xfx> <> | 1:OPEN1(3) 3 <xfx> <> | 3:MINMOD(4) 3 <xfx> <> | 4:STAR(7) 3 <xfx> <> | 7: CLOSE1(9) 3 <xfx> <> | 9: END(0) Match possible, but length=0 is smaller than requested=1, failing! EXACT <f> can match 0 times out of 1 +... failed... Match failed Freeing REx: " (f*?) "

Do you see?

Match possible, but length=0 is smaller than requested=1, failing!
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

In reply to Re^9: Understanding a portion of perlretut by choroba
in thread Understanding a portion on the Perlretut by BlueStarry

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.