In fact, Perl interprets \111 as octal, which is not found in your string. It will only consider two or more digits of backlinks if the number of groups is found. To avoid ambiguity, use \g or \g{} . quoting docs ( perlre - Capture Groups ):
The notation \ g and \ k were introduced in Perl 5.10.0. Prior to this, they were not called relative numbered capture groups. Absolute numbered groups were mentioned using \ 1, \ 2, etc., and this notation is still accepted (and probably always will be). But this leads to some ambiguity if there are more than 9 capture groups, since \ 10 can mean either the tenth capture group or character whose sequence number is octal 010 (backspace in ASCII). Perl resolves this ambiguity by interpreting \ 10 as a backlink only if at least 10 left parentheses have been opened before it. Similar to [11] backreference, only if at least 11 left parentheses were opened before it. And so on. Between 1 and 9 are always interpreted as backlinks. There are several examples below that illustrate these dangers. You can avoid ambiguity by always using \ g {} or \ g if you mean group capturing; and for octal constants always use \ o {} or for \ 077 and below, using 3 digits filled with leading zeros, since the leading zero means an octal constant.
source share