Re: Need match character help

2018-05-20 Thread ToddAndMargo
On 05/20/2018 04:16 PM, yary wrote: PRM's suggestion was "/inverting the entire regex -- i.e., instead of matching finding things that do match, exclude the things that don't ... use !~~ or some similar logic to get the strings wanted/" which IMO is an excellent idea. Your implementation

Re: Need match character help

2018-05-20 Thread yary
PRM's suggestion was "*inverting the entire regex -- i.e., instead of matching finding things that do match, exclude the things that don't ... use !~~ or some similar logic to get the strings wanted*" which IMO is an excellent idea. Your implementation didn't take the inversion into account- try

Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Sun, May 20, 2018 at 03:02:34PM -0700, ToddAndMargo wrote: > On 05/20/2018 10:40 AM, Patrick R. Michaud wrote: > > On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote: > > > On 18/05/18 13:30, The Sidhekin wrote: > > > > > > > >   / ^ <[d..z]>* $/ > > > > > > That's pretty good!

Re: Need match character help

2018-05-20 Thread ToddAndMargo
On 05/20/2018 10:40 AM, Patrick R. Michaud wrote: On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote: On 18/05/18 13:30, The Sidhekin wrote:   / ^ <[d..z]>* $/ That's pretty good! Putting the beginning-of-string anchor ^ anywhere but the very start is surely an advanced move :)

Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote: > On 18/05/18 13:30, The Sidhekin wrote: > > > >   / ^ <[d..z]>* $/ > > That's pretty good! Putting the beginning-of-string anchor ^ anywhere > but the very start is surely an advanced move :) FWIW, sometimes I think it's worth

Re: Need match character help

2018-05-18 Thread ToddAndMargo
On Fri, May 18, 2018 at 1:32 PM, ToddAndMargo > wrote: On 05/18/2018 01:22 PM, ToddAndMargo wrote: To match particular characters. that should have been To match particular characters or phrases I am using

Re: Need match character help

2018-05-18 Thread ToddAndMargo
On 05/18/2018 01:22 PM, ToddAndMargo wrote: To match particular characters. that should have been To match particular characters or phrases I am using "phrase" here in the English language meaning, not the programming meaning

Re: Need match character help

2018-05-18 Thread ToddAndMargo
On 05/15/2018 07:05 AM, Timo Paulssen wrote: On 15/05/18 13:49, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T what you've put in your regex here is a character

Re: Need match character help

2018-05-18 Thread Timo Paulssen
On 18/05/18 13:30, The Sidhekin wrote: > On Thu, May 17, 2018 at 12:51 PM, Timo Paulssen > wrote: > > character classes are fundamentally the wrong thing for "phrases", > since they describe only a character. > > >   You were right the first

Re: Need match character help

2018-05-18 Thread The Sidhekin
On Thu, May 17, 2018 at 12:51 PM, Timo Paulssen wrote: > character classes are fundamentally the wrong thing for "phrases", since > they describe only a character. > You were right the first time. > Your current regex (before changing [gm] to ["gm"]) was expressing "from >

Re: Need match character help

2018-05-17 Thread Norman Gaywood
Nice RE tutorial :-) /^ [ | <[d..z]-[g]> | g ]* $/ One question I have is what is the first | for? On Thu, 17 May 2018 at 21:10, Timo Paulssen wrote: > The description perhaps doesn't point out clearly enough: the reason why > the stuff inside the [ ] will match any amount

Re: Need match character help

2018-05-17 Thread Timo Paulssen
The description perhaps doesn't point out clearly enough: the reason why the stuff inside the [ ] will match any amount of times is only the * at the end, the [ ] is only there because otherwise the regex would instead match something you didn't mean at all. If you're interested, read on for an

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: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 07:05 AM, Timo Paulssen wrote: On 15/05/18 13:49, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T what you've put in your regex here is a character

Re: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 07:06 AM, Timo Paulssen wrote: On 15/05/18 14:03, ToddAndMargo wrote: On 05/15/2018 04:49 AM, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T And

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 14:03, ToddAndMargo wrote: > On 05/15/2018 04:49 AM, ToddAndMargo wrote: >> Hi All, >> >> This should be a "no".  What am I doing wrong? >> >> $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say >> "yes"}else{say "no"}' >> yes >> >> >> Many thanks, >> -T > > And how do I turn this

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 13:49, ToddAndMargo wrote: > Hi All, > > This should be a "no".  What am I doing wrong? > > $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say > "yes"}else{say "no"}' > yes > > > Many thanks, > -T what you've put in your regex here is a character class combined of four

Re: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 04:49 AM, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T And how do I turn this into a yes. I am look for any instance of d through z $ perl6 -e