code: public static Pattern pattern(AbstractConfig config, String key) {
      String pattern = config.getString(key);
  
      try {
        return Pattern.compile(pattern);
      } catch (PatternSyntaxException e) {
        throw new ConfigException(
            key,
            pattern,
            String.format(
                "Could not compile regex '%s'.",
                pattern
            )
        );
      }
    }
docs: Method is used to create a pattern based on the config element.
  
  @param config
  @param key
  @return