Set operations seem to be unsupported on predefined character classes (or
subrules). (Or, if they are supported, I don't know what the right syntax
might be.)

Set operations seem to work properly, though, with escaped character
classes. For example:

perl6 -e 'my $x = "9.0v1"; say so $x ~~ /<[\w] - [\d_]>;/'

or with Unicode properties' short names:

perl6 -e 'my $x = "9.0v1"; say  $x ~~ /<[\w] - :N>/;'
or, to find digits instead of letters:
perl6 -e 'my $x = "9.0v1"; say  $x ~~ /<[\w] - :L>/;'
or this:
perl6 -e 'my $x = "9.0v1"; say  $x ~~ /<[\w] - [:L_]>/;'

But I agree that  using /<digit>/  is probably better. For example:

perl6 -e 'my $x = "9.0v1"; say  $x ~~ /^<digit>+$/;

or possibly:
perl6 -e 'my $x = "9.0v1'; say  $x !~~ /<-[\d]>/;'

Best,
Laurent.

2018-08-02 7:00 GMT+02:00 Brandon Allbery <allber...@gmail.com>:

> Set operations have to be inside the <>. You want something like:
> /<[alnum-alpha]>/.
>
> That said, this would be the same as /<digit>/, I think? Please describe
> in words what you intended with that regex. (I suspect /<[alpha]>/ is what
> you really want, based on your earlier statement.)
>
> On Thu, Aug 2, 2018 at 12:57 AM ToddAndMargo <toddandma...@zoho.com>
> wrote:
>
>> Hi All,
>>
>> If there are any letter in the string, I want it to fail
>>
>>
>>
>> $ p6 'my $x="9.0v1"; if $x~~/<+alnum>-[<alpha>]>/ {say "Y";}'
>> ===SORRY!===
>> Unrecognized regex metacharacter - (must be quoted to match literally)
>> at -e:1
>> ------> my $x="9.0v1"; if $x~~/<+alnum>⏏-[<alpha>]>/ {say "Y";}
>> Unable to parse regex; couldn't find final '/'
>> at -e:1
>> ------> my $x="9.0v1"; if $x~~/<+alnum>-⏏[<alpha>]>/ {say "Y";}
>>
>>
>>
>> What am I doing wrong?
>>
>> Many thanks,
>> -T
>>
>
>
> --
> brandon s allbery kf8nh
> allber...@gmail.com
>

Reply via email to