while ($teststring =~ /\b(\w+-\w+-\w+)\b/gi) { print "$1\n"; }