#!/usr/bin/perl use strict; use warnings; my $tests = [ 'ONT |Status |% Complete ----|--------------------|---------- 1.1 |activate complete |100 1.2 |activate complete |100 1.3 |activate complete |100 1.4 |activate complete |100 2.1 |activate complete |100 2.2 |activate complete |100 2.3 |activate failed |100 2.4 |activate complete |100 ' ]; # Negative check....should pass as long as the word failed is not in the text string my $regex = '^((?!failed).)*$'; #my $regex = 'ONT.*activate failed.*$'; foreach my $test (@$tests) { if($test =~ qr{$regex}ms) { print "$test\n REGEX MATCHED\n"; } else { print "$test\n REGEX DID NOT MATCH!\n"; } }