D:\tmp>perl -Mre=debug -e"'foo' =~ m{ ( o? )* }x;" Compiling REx " ( o? )* " Final program: 1: CURLYX[0]{0,INFTY} (12) 3: OPEN1 (5) 5: CURLY{0,1} (9) 7: EXACT (0) 9: CLOSE1 (11) 11: WHILEM[1/1] (0) 12: NOTHING (13) 13: END (0) minlen 0 Matching REx " ( o? )* " against "foo" 0 <> | 0| 1:CURLYX[0]{0,INFTY}(12) 0 <> | 1| 11:WHILEM[1/1](0) | 1| WHILEM: matched 0 out of 0..65535 0 <> | 2| 3:OPEN1(5) 0 <> | 2| 5:CURLY{0,1}(9) | 2| EXACT can match 0 times out of 1... 0 <> | 3| 9:CLOSE1(11) 0 <> | 3| 11:WHILEM[1/1](0) | 3| WHILEM: matched 1 out of 0..65535 | 3| WHILEM: empty match detected, trying continuation... <---- HERE 0 <> | 4| 12:NOTHING(13) 0 <> | 4| 13:END(0) Match successful! Freeing REx: " ( o? )* " D:\tmp>