On Fri, Jun 19, 2020 at 12:12 AM Joseph Brenner wrote:
>
> > Anyway, I had quite forgotten that you had updated to 2020.05.1 (I thought
> > you were
> still on 2019.03.1).
>
> I still use the 2019.03 release pretty frequently, but I've got a
> newer release around I can check with.
>
> > FYI, I h
> Anyway, I had quite forgotten that you had updated to 2020.05.1 (I thought
> you were
still on 2019.03.1).
I still use the 2019.03 release pretty frequently, but I've got a
newer release around I can check with.
> FYI, I had been trying to write a line of code that calls the ".words"
method on
Hi Joe,
Yup, your test file works perfectly:
Last login: Thu Jun 18 19:38:12 on ttys000
user@mbook:~$ perl6 regexp_code_interpolation_with_capture_var.t
ok 1 - case: {} $(... $0 ...)
ok 2 - case: <{... $0 ... .subst(/\s/, '\s', :g)}>
ok 3 - case: {} "... $0 ..." (brad gilbert rec)
ok 4 - case: {
I don't have a 2020.02.1 around, but I see all of this working
with both more recent and earlier versions: 2020.05.1 and 2019.03.1.
> 1. I got your first "if" line (below) from June 14th to work, the one
> you said, "it's not a complete solution":
> 1> if $line ~~ / (^P\d+) \s+ <{ %products{$0}.su
cf:
https://stackoverflow.com/questions/56393888/why-how-is-an-additional-variable-needed-in-matching-repeated-arbitary-character
https://stackoverflow.com/questions/51408141/perl6-grammar-not-sure-about-some-syntax-in-an-example
Hi Joe,
1. I got your first "if" line (below) from June 14th to work, the one
you said, "it's not a complete solution":
1> if $line ~~ / (^P\d+) \s+ <{ %products{$0}.subst(/\s+/, '\s', :g) }> / {
2. I got Brad's "if" line (below) from June 15th to work:
2> if $line ~~ / (^P\d+) \s+ {} "%products{
Just wondering if the docs describe how to access an "inner" capture
once saved to a variable? If not maybe the code below would be helpful
(from yary's last example, REPL output):
> my $capture = "1122" ~~ /(\d) {} :my $c=$0; ($c (\d) $0)/
「1122」
0 => 「1」
1 => 「122」
0 => 「2」
> say $capture
「1
On 6/15/20, yary wrote:
> The Match docs can be clearer on when to use {} and when it isn't needed,
I agree, in fact I'm inclined to think this is an actual bug (design error?).
It's pretty strange that the two kinds of code interpolation behave so
differently:
$(...) requires you to do somethin
Brad Gilbert wrote:
> You don't want to use <{…}>, you want to use ""
> if $line ~~ / (^P\d+) \s+ {} "%products{$0}" / {
Well, as contrived examples go this one could be
improved. Instead of directly dereferencing a
hash, maybe I should've used a sub call.
> Note that {} is there to update
Brad: "Note that {} is there to update $/ so that $0 works the way you
would expect"
I ran into that before & was trying to remember that detail... found it in
https://docs.raku.org/language/regexes#Capture_numbers
But the example is a bit on the obtuse side:
These capture variables are only ava
You don't want to use <{…}>, you want to use ""
if $line ~~ / (^P\d+) \s+ {} "%products{$0}" / {
Note that {} is there to update $/ so that $0 works the way you would expect
Although I would do something like this instead:
my ($code,$desc) = $line.split( /\s+/, 2 );
if %products{$co
True, and I am well and truly baffled by my example where the 1st bad line
incorrectly is labelled good, the 2nd bad line is correctly labelled bad,
and the 3rd good like is correctly labelled good.
-y
On Sun, Jun 14, 2020 at 6:04 PM Joseph Brenner wrote:
> > Just to be be clear, my idea is th
> Just to be be clear, my idea is the second line is wrong, and it
should flag that one as a problem
Oh, but if you go literally with the code I posted, *both* the first
and second lines have incorrect descriptions, and only the third line
("corn dogs") matches.
(That was a mistake when I wro
Getting correct behavior is an improvement over my try like so, which
gets the same warning but fails all the lines:
/ (^P\d+) \s+ $(%products{$0}) /
On 6/14/20, yary wrote:
> I should have read the output!
>
> This one gives the right answers but with lots of warnings
> / (^P\d+) \s+ $("%pro
I should have read the output!
This one gives the right answers but with lots of warnings
/ (^P\d+) \s+ $("%products{$0}") /
checking line: P123 Viridian Green Label Saying Magenta
Use of Nil in string context
in regex at regex-loop.p6 line 18
Use of Nil in string context
in regex at r
Well, with the first one it rejects all of my lines, and with the
second one it passes all of them.
Just to be be clear, my idea is the second line is wrong, and it
should flag that one as a problem
On 6/14/20, yary wrote:
> https://docs.raku.org/language/regexes#Regex_interpolation gave m
https://docs.raku.org/language/regexes#Regex_interpolation gave me some
ideas
Try matching against / (^P\d+) \s+ %products{$0} /
This one also works, in a roundabout way
/ (^P\d+) \s+ {"%products{$0}"} /
-y
On Sun, Jun 14, 2020 at 4:44 PM Joseph Brenner wrote:
> In part because of the recen
17 matches
Mail list logo