use strict; use warnings; my $line = "root (hd1,1)"; my $match = qr/root \(hd[0-9],[0-9]\)/i; if ($line =~ $match) { print "match 1 found \n"; }