use v5.30.0; use strict; #use re 'debug'; #use Regexp::Debugger; my $str = '\'foooooooooobar and fubar\''; say $str; # # Since + is 1 to unlimited, the unlimited exceeds 255, so unless you limit the max # to something less than 255, the look behind will not compile. # my $re = qr/(?<=fo{1,254}?) \K obar/x; say $re; say "After exiting the look behind, Perl forgets whatever matched before \\K"; $str =~ $re; say $& if $&; exit(0); __END__