$ perl -le ' > $_ = "gjhgjhgjg sata kjhkhkjhkjhkj N/A khkjhkhkhkj N/A"; > print q{ok} if m{(?ix) (?=.*\bn/a\b.+\bn/a\b) (?=.*\bsata\b)};' ok $