public @Nullable Pattern getOrCreatePattern(@NotNull String regex) {
    try {
      if (!PATTERNS_CACHE.containsKey(regex)) {
        PATTERNS_CACHE.put(regex, Pattern.compile(regex));
      }
      return PATTERNS_CACHE.get(regex);
    }
    catch (PatternSyntaxException e) {
      return null;
    }
  }
public @Nullable Pattern getOrCreatePattern(@NotNull String regex)