You need to be more careful with regexes (any regexes). Your character
class matches if any character in the string matches, so 'd' satisfies it
and the rest of the string is ignored. If you want to ensure *no* character
matches, then say so:

pyanfar Z$ 6 'if "dgm" ~~ /^<[d..z]-[gm]>*$/ {say "y"} else {say "n"}'
n


On Wed, May 16, 2018 at 9:05 PM, Todd Chester <toddandma...@zoho.com> wrote:

>
>
> On 05/16/2018 07:58 AM, Timo Paulssen wrote:
>
>> On 16/05/18 00:10, ToddAndMargo wrote:
>>
>>> What would the syntax be for d..z, but not g or m?
>>>
>>
>> You can subtract [gm] from [d..z] like this:
>>
>>      say "c" ~~ /<[d..z]-[gm]>/;
>>      say "d" ~~ /<[d..z]-[gm]>/;
>>      say "f" ~~ /<[d..z]-[gm]>/;
>>      say "g" ~~ /<[d..z]-[gm]>/;
>>
>>
> Something is wrong:
>
> $ p6 'if "dgm" ~~ /<[d..z]-[gm]>/ {say "yes"}else{say "no"};'
> yes
>
> I want it to fail if it find g or m
>
> :'(
>
>
> $ alias p6
> alias p6='perl6 -e'
>



-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to