@Override
  public ProblemDescriptor @Nullable [] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
    if (myConfigurations.isEmpty()) return null;
    final Document document = file.getViewProvider().getDocument();
    final CharSequence text = document.getCharsSequence();
    final FindManager findManager = FindManager.getInstance(file.getProject());
    final Project project = manager.getProject();
    final InspectionProfileImpl profile =
      (mySessionProfile != null && !isOnTheFly) ? mySessionProfile : InspectionProfileManager.getInstance(project).getCurrentProfile();
    final List<ProblemDescriptor> descriptors = new SmartList<>();
    for (RegExpInspectionConfiguration configuration : myConfigurations) {
      final String uuid = configuration.getUuid();
      final ToolsImpl tools = profile.getToolsOrNull(uuid, project);
      if (tools != null && !tools.isEnabled(file)) {
        continue;
      }
      addInspectionToProfile(project, profile, configuration); // hack
      register(configuration);

      for (RegExpInspectionConfiguration.InspectionPattern pattern : configuration.getPatterns()) {
        FileType fileType = pattern.fileType();
        if (UnknownFileType.INSTANCE != fileType && file.getFileType() != fileType) continue;
        final FindModel model = new FindModel();
        model.setRegularExpressions(true);
        model.setStringToFind(pattern.regExp());
        final String replacement = pattern.replacement();
        if (replacement != null) {
          model.setStringToReplace(replacement);
        }
        model.setSearchContext(pattern.searchContext());
        VirtualFile vFile = file.getVirtualFile();
        FindResult result = findManager.findString(text, 0, model, vFile);
        while (result.isStringFound()) {
          final TextRange range = new TextRange(result.getStartOffset(), result.getEndOffset());
          PsiElement element = file.findElementAt(result.getStartOffset());
          assert element != null;
          while (!element.getTextRange().contains(range)) {
            element = element.getParent();
          }
          final TextRange elementRange = element.getTextRange();
          final int start = result.getStartOffset() - elementRange.getStartOffset();
          final TextRange warningRange = new TextRange(start, result.getEndOffset() - result.getStartOffset() + start);
          final String problemDescriptor = StringUtil.defaultIfEmpty(configuration.getProblemDescriptor(), configuration.getName());
          final CustomRegExpQuickFix fix = replacement == null ? null : new CustomRegExpQuickFix(findManager, model, text, result);
          final ProblemDescriptor descriptor =
            manager.createProblemDescriptor(element, warningRange, problemDescriptor, GENERIC_ERROR_OR_WARNING, isOnTheFly, fix);
          descriptors.add(new ProblemDescriptorWithReporterName((ProblemDescriptorBase)descriptor, uuid));
          result = findManager.findString(text, result.getEndOffset(), model, vFile);
        }
      }
    }

    return descriptors.toArray(ProblemDescriptor.EMPTY_ARRAY);
  }
@Override
  public ProblemDescriptor @Nullable [] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly)