Re: how do I match the next two characters?

2018-01-22 Thread ToddAndMargo
On Fri, Jan 19, 2018 at 12:29 AM, Todd Chester > wrote: On 01/18/2018 05:17 PM, mimosinnet wrote: The '?' is not necessary Indeed! I use `.*?` when I do not want the wild card to be "greedy" When I have a

Re: how do I match the next two characters?

2018-01-18 Thread Todd Chester
On 01/18/2018 05:17 PM, mimosinnet wrote: The '?' is not necessary Indeed! I use `.*?` when I do not want the wild card to be "greedy" When I have a choice of using either, I always use `.*?` so I remember the difference and as a kind of comment that tells me not to be greedy. Thank you!

Re: how do I match the next two characters?

2018-01-18 Thread Andy Bach
>The '?' is not necessary ;-) perl6 -e 'my $x="abcsdd1efg1234xyz"; $x ~~ m/(sd..).*(12..)/; say "$0, $1"' sdd1, 1234 The "?" is to modify the "*" to be "non-greedy" - that is, it will match the first chunk of stuff that is followed by whatever is after it (so, "/*?/" the "?" is certainly

Re: how do I match the next two characters?

2018-01-18 Thread mimosinnet
Thanks for this thread El Tuesday, 16 de January del 2018 a les 19:28, Todd Chester va escriure: But I do have to use `.*?` in the middle when matching two things $ perl6 -e 'my $x="abcsdd1efg1234xyz"; $x ~~ m/(sd..).*?(12..)/; say "$0, $1"' sdd1, 1234 The '?' is not necessary ;-) perl6

Re: how do I match the next two characters?

2018-01-16 Thread Todd Chester
On 01/16/2018 12:57 AM, Elizabeth Mattijsen wrote: On 16 Jan 2018, at 09:46, ToddAndMargo wrote: I want to match the next two character (don't care what they are) in the following I will use ?? for the next two character, but that doesn't work $x ~~ m/.*?(sd??).*/;

Re: how do I match the next two characters?

2018-01-16 Thread ToddAndMargo
On 01/16/2018 12:57 AM, Elizabeth Mattijsen wrote: On 16 Jan 2018, at 09:46, ToddAndMargo wrote: I want to match the next two character (don't care what they are) in the following I will use ?? for the next two character, but that doesn't work $x ~~ m/.*?(sd??).*/; I

Re: how do I match the next two characters?

2018-01-16 Thread Elizabeth Mattijsen
> On 16 Jan 2018, at 09:46, ToddAndMargo wrote: > I want to match the next two character (don't care what > they are) in the following > > I will use ?? for the next two character, but that doesn't work > $x ~~ m/.*?(sd??).*/; > > I want $0 to include the "sd" and the

how do I match the next two characters?

2018-01-16 Thread ToddAndMargo
Hi All, I want to match the next two character (don't care what they are) in the following I will use ?? for the next two character, but that doesn't work $x ~~ m/.*?(sd??).*/; I want $0 to include the "sd" and the next two characters, whatever they are. Many thanks, -T