The '=~' operator is used for regular expression matching, but it's not supported within the single square bracket construct. Use the double square brackets construct for regular expression matching.