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"}
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
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"}
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
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]>/;
That is absolutely correct, thanks!