$ /opt/perl/5.6.1/bin/perl -wle 'print "Reject" unless "PH0022080209401500001PE-000" =~ /^PH.*?[^(H\-000)(IF\-000)]$/' Reject $