$string = '--*test--'; if ( $string =~ /\btest\b/ ) { print "$string matched.\n" }