I need regex last instance help

[email protected] (ToddAndMargo via perl6-users) Sat, 25 Oct 2025 05:19:05 -0700
Newsgroups perl.perl6.users
Message-ID <[email protected]>
Hi All,

What am I doing wrong here:

[2] > my Str $x = "1.40.564"; $x~~s:i/ '.' $$ .* //; print "$x\n";
1.40.564

I am after "1.40"

This is my work around, but I'd really like to know
how to do it right:

my Str $x = "1.40.564"; $x~~m:i/ ( .*? '.') (.*? ) '.' /; print "$0$1\n";
1.40

Your in confusion,
-T