Skip Menu |
Report information
Id: 130549
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: comdog <brian.d.foy [at] gmail.com>
Cc: samantham [at] posteo.net
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: <:Digit> apparently matches anything
From: brian d foy <brian.d.foy [...] gmail.com>
To: rakudobug [...] perl.org
Date: Fri, 13 Jan 2017 03:29:46 -0500
Download (untitled) / with headers
text/plain 1.5k
I mistakenly tried to match the Unicode property <:Digit> when I meant number. It's not one of the properties listed in the table in Regexes[1], although it is in perluniprops[2] as a Perl 5 extension as a synonym for XPosixDigit. I didn't mean to use it and I don't particularly care if Perl 6 supports it. However, I didn't get an error and it appears to match everything (almost): $ perl6 -v This is Rakudo version 2016.11 built on MoarVM version 2016.11 implementing Perl 6.c. $ perl6 To exit type 'exit' or '^D' Show quoted text
> q/'/ ~~ rx/ <:Digit> /
「'」 Show quoted text
> q/a/ ~~ rx/ <:Digit> /
「a」 Show quoted text
> qq/\c[CAT FACE]/ ~~ rx/ <:Digit> /
「🐱」 Show quoted text
> q/'/ ~~ rx/ <:SomeStupidThingIMadeUp> /
(Any) The <:SomeStupidThingIMadeUp> non-existent property fails to match, which is fine. Regex[1] says: ...<:property> , where property can be a short or long Unicode General Category name. "can" is a bit ambiguous since it might mean it "is limited to" or is "not disallowed". It should probably be the more limited form ("it must be a") and fail otherwise. There are about 2,625 characters that don't match in this range: my $matches = 0; for 0 .. 0x10fffd { unless chr($_) ~~ / <:Digit> / { put $_.fmt('%#6X'), ": ", chr($_); next; } $matches++ if chr($_) ~~ / <:Digit> /; } put "Characters not matching: ", 0x10fffd - $matches; [1] https://docs.perl6.org/language/regexes#Unicode_properties [2] http://perldoc.perl.org/perluniprops.html


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org