Re: Need match character help

2018-05-16 Thread Todd Chester
Now I am getting silly. How would I exclude the phrase "gm"? $ p6 'if "def" ~~ /^<[d..z]-["gm"]>*$/ {say "y"} else {say "n"}' Potential difficulties: Quotes are not metacharacters in character classes at -e:1 --> if "def" ~~ /^<[d..z]-⏏["gm"]>*$/ {say "y"} else {say "n"}

Re: Need match character help

2018-05-16 Thread Todd Chester
On Wed, May 16, 2018 at 9:05 PM, Todd Chester > 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

Re: Need match character help

2018-05-16 Thread Brandon Allbery
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"}

Re: Need match character help

2018-05-16 Thread Todd Chester
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

Re: Need match character help

2018-05-16 Thread Timo Paulssen
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]>/;

Re: number of letters question

2018-05-16 Thread Timo Paulssen
That is absolutely correct, thanks!