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 $>/

# Match all but at start- this puzzles me, 'a' is after the start of string
but still matches
> 'abcd' ~~ m/<!after ^>.+/

# This is a workaround
> 'abcd' ~~ m/<!before ^>.+/

Using a perl5 debugger session, roughly translated negative
lookbehind/lookahead work as I expect.

  DB<1> p 'abcd' =~ /(.+(?!$))/
  DB<2> p 'abcd' =~ /((?<!^).*)/


Reply via email to