http://qs321.pair.com?node_id=624303


in reply to Need RegExp help - doing an AND match

Here's one way to do it with regex:
use strict; use warnings; my $re = qr{ ^ (?=.*foo) (?=.*bar) }x; while (my $line = <DATA>) { print $line if $line =~ $re; } __DATA__ foo bar foo bar bar foo abc foo bar