#!/usr/bin/perl use warnings; use strict; while(<>) { if(m/\bSYB_([A-Z])+_([A-Z0-9])+\b|\b(ASESMR|ASERMR)([A-Z0-9])+\b/) {print "Found a match $_\n";} }