@Nonnull
	private static ThreadLocalPattern generate(@Nonnull String regex) {
		if (FAILED_PATTERNS.containsKey(regex))
			return INVALID_PATTERN;
		try {
			return new ThreadLocalPattern(new Pattern(regex));
		} catch (Throwable t) {
			FAILED_PATTERNS.put(regex, new RegexValidation(false, t.getMessage()));
			logger.error("Invalid regex pattern", t);
			return INVALID_PATTERN;
		}
	}
@param regex
		Regular expression to compile.

@return Compiled pattern, or {@link #INVALID_PATTERN} if the pattern is invalid.
recaf-core/src/main/java/software/coley/recaf/util/RegexUtil.java