Hi Sean, From the docs: ____ Lookbehind assertions: https://docs.perl6.org/language/regexes#Lookbehind_assertions
"To check that a pattern appears after another pattern, use a lookbehind assertion via the after assertion. This has the form: <?after pattern> "Therefore, to search for the string bar immediately preceded by the string foo, use the following regexp: / <?after foo> bar / ____ So for a lookbehind assertion , the 'after" comes first and the pattern comes second, within the "<>". Also, you didn't give the regex a "bar" pattern to key on after the lookbehind assertion (see above), so the lookbehind apparently becomes the primary matching sequence. Without the "dot" there, you simply append an "x" to the end of "1:" (see code below). However, you added a "dot" ahead of (and outside of) the lookbehind assertion. If I'm interpreting the results below correctly, it looks as if a literal "1:" is matched in all cases, however placing a "dot" before the lookbehind assertion changes the "registration" (overlap) between the literal and the replacement sequence, creating a single-character overlap. Adding two "dots" before the lookbehind assertion creates a two character overlap: > my $str = '1:'; 1: > $str ~~ s/<?after '1:'>/x/; 「」 > say $str 1:x > my $str = '1:'; 1: > $str ~~ s/.<?after '1:'>/x/; 「:」 > say $str 1x > my $str = '1:'; 1: > $str ~~ s/..<?after '1:'>/x/; 「1:」 > say $str x > say $*VM moar (2019.07.1) > HTH, Bill. On Thu, Aug 22, 2019 at 12:26 PM Sean McAfee <eef...@gmail.com> wrote: > > This seems like a bug, but I thought I'd ask here before reporting it. > > $_ = '1:'; > s/.<?after '1:'>/x/; > .say; > > This prints "1x". Is that what's supposed to happen somehow? I would have > thought that '1:' should only match a literal "1:", leaving nothing for the > dot to match. >