$NetPattern = 'mbist[\w+\d+\/]*\[\d+\]'; if ($NetName =~ qr/$NetPattern/x) {# Do fantastical things...}