# New Ticket Created by  "brian d foy" 
# Please include the string:  [perl #130549]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130549 >


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'
    > q/'/ ~~ rx/ <:Digit> /
    「'」
    > q/a/ ~~ rx/ <:Digit> /
    「a」
    > qq/\c[CAT FACE]/ ~~ rx/ <:Digit> /
    「🐱」
    > 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

Reply via email to