public Pattern compileRegExp() {
    Pattern pattern = myPattern;
    if (pattern == PatternUtil.NOTHING) {
      String toFind = getStringToFind();
      int flags = isCaseSensitive() ? Pattern.MULTILINE : Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;

      // SOE during matching regular expressions is considered to be feature
      // http://bugs.java.com/view_bug.do?bug_id=6882582
      // http://bugs.java.com/view_bug.do?bug_id=5050507
      // IDEA-175066 / https://stackoverflow.com/questions/31676277/stackoverflowerror-in-regular-expression
      if (toFind.contains("\\n") && Registry.is("jdk.regex.soe.workaround")) { // if needed use DOT_ALL for modified pattern to avoid SOE
        String modifiedStringToFind = StringUtil.replace(toFind, "\\n|.", ".");
        modifiedStringToFind = StringUtil.replace(modifiedStringToFind, ".|\\n", ".");

        if (!modifiedStringToFind.equals(toFind)) {
          flags |= Pattern.DOTALL;
          toFind = modifiedStringToFind;
        }
      }
      try {
        myPattern = pattern = Pattern.compile(toFind, flags);
      }
      catch (PatternSyntaxException e) {
        myPattern = pattern = null;
      }
    }

    return pattern;
  }
public Pattern compileRegExp()