cast pattern to Regexp before checking in validations