code: private static void validateRegex(String regex) {
  		if (regex == null) {
  			throw new IllegalArgumentException("The regular expression must not be null.");
  		}
  		String trimmedRegex = regex.trim();
  		if (!trimmedRegex.isEmpty()) {
  			Pattern.compile(trimmedRegex, Pattern.CASE_INSENSITIVE);
  		}
  	}
docs: Validates that the given regular expression is not {@code null} nor invalid.
  
  @param regex the regular expression to be validated
  @throws IllegalArgumentException if the regular expression is {@code null}.
  @throws PatternSyntaxException if the regular expression is invalid.