Check whether a variable is a regular expression