It turns out that this is not a bug. Perl behaves correctly in this case. The explanation is that contents of capture buffers of the topmost re are not accessible from recursed subpatterns. This is mentioned in perlre actually: "(?PARNO)" ... Capture buffers contained by the pattern will have the value as determined by the outermost recursion. Thus, when the regex engine recurses to subpattern 2, capture 1 has never matched, and thus a backreference to it fails no matter what. You can save the obfu the following way, which works in at least perl 5.10.0, 5.10.1, 5.12.0, 5.12.1, 5.13.6: perl -le'$==0,(1x$_)=~ /^(|()1(?1)(?1)\2)$(?{$=++})^/, print$=for 0..13' Please mark the ticket as not a bug, and sorry for the bother, AmbrusThread Previous