code: public void expectRegex(String name, Pattern pattern, String message) {
          String value = Optional.ofNullable(get(name)).orElse("");
  
          if (!pattern.matcher(value).matches()) {
              addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.REGEX_KEY.name(), name)));
          }
      }
docs: Validates a field by a given regular expression pattern
  
  It is required to pass a pre-compiled pattern, e.g.
  Pattern pattern = Pattern.compile("[a-Z,0-9]")
  
  @param pattern The pre-compiled pattern
  @param name The field to check
  @param message A custom error message instead of the default one