I want to match something anywhere but at the end of a string in one example, or anywhere but at the start of a string in another example. The "except at start" one has me stumped. Not sure if it's me or if I've tickled a bug.
perl6 --version This is Rakudo Star version 2018.01 built on MoarVM version 2018.01 implementing Perl 6.c. # Match all but at end- this works as I like > 'abcd' ~~ m/.+<!before $>/ 「abc」 # Match all but at start- this puzzles me, 'a' is after the start of string but still matches > 'abcd' ~~ m/<!after ^>.+/ 「abcd」 # This is a workaround > 'abcd' ~~ m/<!before ^>.+/ 「bcd」 Using a perl5 debugger session, roughly translated negative lookbehind/lookahead work as I expect. DB<1> p 'abcd' =~ /(.+(?!$))/ abc DB<2> p 'abcd' =~ /((?<!^).*)/ bcd -y