Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^9: Understanding a portion of perlretut

by choroba (Cardinal)
on Dec 10, 2015 at 22:51 UTC ( [id://1149963]=note: print w/replies, xml ) Need Help??


in reply to Re^8: Understanding a portion of perlretut
in thread Understanding a portion on the Perlretut

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,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1149963]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found