code: protected void validateRegex(String field, String regExpression, boolean isCaseSensitive, String errorKey, String errorMessage) {
          String value = controller.getPara(field);
          if (value == null) {
          	addError(errorKey, errorMessage);
          	return ;
          }
          Pattern pattern = isCaseSensitive ? Pattern.compile(regExpression) : Pattern.compile(regExpression, Pattern.CASE_INSENSITIVE);
          Matcher matcher = pattern.matcher(value);
          if (!matcher.matches()) {
          	addError(errorKey, errorMessage);
          }
  	}
docs: Validate regular expression.