>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 unneeded) as opposed to the normal meaning of "*" which is, "match as much of anything ("excepting newline") as possible" - so ".*?12" matches up to the first "12" while ".*12" matches as much as possible up to a last "12" a On Thu, Jan 18, 2018 at 7:17 PM, mimosinnet <mimosin...@gmail.com> wrote: > 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 -e 'my $x="abcsdd1efg1234xyz"; $x ~~ m/(sd..).*(12..)/; say "$0, $1"' > sdd1, 1234 > > > Cheers! -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk