return error if pattern is not a regular expression
remove the shame