DEV Community

Discussion on: 100 Languages Speedrun: Episode 47: Raku (Perl 6) Regular Expressions

 
taw profile image
Tomasz Wegrzanowski

It is a bug, because \d is extremely well established to match [0-9] and this is about the most common regexp escape code, programmers will rely on this, and this "almost" works.

I think the fact that Raku documentation has this issue, on the same page even, pretty much proves it. According to that documentation ௩.௩.௩.௩ is a valid IP address.

<:Nd> is such a rare thing you'd have a lot of trouble coming with a single use case for it. If you think it can find numbers in text you don't know language of (and how often is that a thing?), it won't even do that (Chinese and Roman numbers being most obvious). And if you somehow come up with a super rare use case for <:Nd>, you can use <:Nd> - or more likely some much more specific character class like /<:Nd>&<:Tamil>/.

Thread Thread
 
lizmat profile image
Elizabeth Mattijsen

Well, I guess there is one place where \d is intended to match all numerics. And that's the grammar that Raku uses to parse Raku source code. Which allows the example Jonathan Stowe gave to work.

I see that we will not agree on whether the current behaviour is correct or not (even though apparently Raku is not the only one).

I'm looking forward to you covering of Raku grammars. :-)