in reply to pattern matching words in any order
This achieves the AND requirement, but note the possibility of false matches if there is overlap between the two words (3rd example):
[0] Perl> $re = qr[(?=^.*this)(?=^.*that)];; [0] Perl> $_ =~ $re and print "$_ matched" for qw[thisthat thatthis thathis thisnthat thatnthis];; thisthat matched thatthis matched thathis matched ** thisnthat matched thatnthis matched
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: pattern matching words in any order
by grizzley (Chaplain) on Oct 26, 2009 at 08:53 UTC |