perl -Mre=debug -le " $_=q{fakesite.com/f/files-url/blah.png}; if(m{fakesite.com.*}){ warn 1; if(/files-url/){ die 2 }} " #### $ perl -Mre=debug -le " $_=q{fakesite.com/f/files-url/blah.png}; if(m{fakesite.com.*}g){ warn 1; if(/files-url/g){ die 2 }} " Compiling REx "fakesite.com.*" Final program: 1: EXACT (4) 4: REG_ANY (5) 5: EXACT (7) 7: STAR (9) 8: REG_ANY (0) 9: END (0) anchored "fakesite" at 0 (checking anchored) minlen 12 Compiling REx "files-url" Final program: 1: EXACT (5) 5: END (0) anchored "files-url" at 0 (checking anchored isall) minlen 9 Guessing start of match in sv for REx "fakesite.com.*" against "fakesite.com/f/files-url/blah.png" Found anchored substr "fakesite" at offset 0... Guessed: match at offset 0 Matching REx "fakesite.com.*" against "fakesite.com/f/files-url/blah.png" 0 <> | 1:EXACT (4) 8 <.com/f/fil> | 4:REG_ANY(5) 9 | 5:EXACT (7) 12 | 7:STAR(9) REG_ANY can match 21 times out of 2147483647... 33 <> | 9: END(0) Match successful! 1 at -e line 1. Freeing REx: "fakesite.com.*" Freeing REx: "files-url" $ $ perl -Mre=debug -le " $_=q{fakesite.com/f/files-url/blah.png}; if(m{fakesite.com.*}){ warn 1; if(/files-url/){ die 2 } } " Compiling REx "fakesite.com.*" Final program: 1: EXACT (4) 4: REG_ANY (5) 5: EXACT (7) 7: STAR (9) 8: REG_ANY (0) 9: END (0) anchored "fakesite" at 0 (checking anchored) minlen 12 Compiling REx "files-url" Final program: 1: EXACT (5) 5: END (0) anchored "files-url" at 0 (checking anchored isall) minlen 9 Guessing start of match in sv for REx "fakesite.com.*" against "fakesite.com/f/files-url/blah.png" Found anchored substr "fakesite" at offset 0... Guessed: match at offset 0 Matching REx "fakesite.com.*" against "fakesite.com/f/files-url/blah.png" 0 <> | 1:EXACT (4) 8 <.com/f/fil> | 4:REG_ANY(5) 9 | 5:EXACT (7) 12 | 7:STAR(9) REG_ANY can match 21 times out of 2147483647... 33 <> | 9: END(0) Match successful! 1 at -e line 1. Guessing start of match in sv for REx "files-url" against "fakesite.com/f/files-url/blah.png" Found anchored substr "files-url" at offset 15... Starting position does not contradict /^/m... Guessed: match at offset 15 2 at -e line 1. Freeing REx: "fakesite.com.*" Freeing REx: "files-url" $ #### $ perl -Mre=debug -le "$f=123; $f=~/^.*/g; warn pos $f; $f=~ /\d/g; warn pos $f; " Compiling REx "^.*" Final program: 1: BOL (2) 2: STAR (4) 3: REG_ANY (0) 4: END (0) anchored(BOL) minlen 0 Compiling REx "\d" Final program: 1: DIGIT (2) 2: END (0) stclass DIGIT minlen 1 Matching REx "^.*" against "123" 0 <> <123> | 1:BOL(2) 0 <> <123> | 2:STAR(4) REG_ANY can match 3 times out of 2147483647... 3 <123> <> | 4: END(0) Match successful! 3 at -e line 1. Warning: something's wrong at -e line 1. Freeing REx: "^.*" Freeing REx: "\d" $ perl -Mre=debug -le "$f=123; $f=~/^.*/; warn pos $f; $f=~ /\d/; warn pos $f; " Compiling REx "^.*" Final program: 1: BOL (2) 2: STAR (4) 3: REG_ANY (0) 4: END (0) anchored(BOL) minlen 0 Compiling REx "\d" Final program: 1: DIGIT (2) 2: END (0) stclass DIGIT minlen 1 Matching REx "^.*" against "123" 0 <> <123> | 1:BOL(2) 0 <> <123> | 2:STAR(4) REG_ANY can match 3 times out of 2147483647... 3 <123> <> | 4: END(0) Match successful! Warning: something's wrong at -e line 1. Matching REx "\d" against "123" Matching stclass DIGIT against "123" (3 bytes) 0 <> <123> | 1:DIGIT(2) 1 <1> <23> | 2:END(0) Match successful! Warning: something's wrong at -e line 1. Freeing REx: "^.*" Freeing REx: "\d" $