code: public static Pattern createRegExPatternIfValid(String _regExStr) {
          if (StringUtil.isBlank(_regExStr)) {
              return null;
          }
  
          Pattern pattern;
          try {
              pattern = Pattern.compile(_regExStr);
          } catch (PatternSyntaxException _ex) {
              return null;
          }
  
          return pattern;
      }
docs: Creates a RegEx Pattern object, if given String is a valid regular expression.
  
  @param _regExStr regex string to check
  @return Pattern-Object or null if given String is no valid RegEx