Re: I need regex last instance help

[email protected] (William Michels) Sun, 26 Oct 2025 20:51:14 -0700
Newsgroups perl.perl6.users
Message-ID <[email protected]>
In the Raku REPL:

[0] > .Str.say for "first line\nsecond line" ~~ m:g/ ^ \w+ /
first
[0] > .Str.say for "first line\nsecond line" ~~ m:g/ ^^ \w+ /
first
second
[0] > .Str.say for "line first\nline second" ~~ m:g/ \w+ $ /
second
[0] > .Str.say for "line first\nline second" ~~ m:g/ \w+ $$ /
first
second

HTH, Bill.

> On Oct 26, 2025, at 14:50, ToddAndMargo via perl6-users <[email protected]> wrote:
> 
> On 10/26/25 7:56 AM, William Michels wrote:
>> ^^  has the regex meaning "start-of-line"
>> $$  has the regex meaning "end-of-line"
>> Compare to:
>> ^  has the regex meaning "start-of-string"
>> $  has the regex meaning "end-of-string"
>> If you're analyzing input linewise (for example using a one-liner with `-ne` or `-pe` flags),
>> then start-of-line equals start-of-string, and end-of-line equals end- of-string.
>> HTH, Bill.
> 
> 
> Can I talk you out of a few examples?