void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof RegExpPattern pattern)) { return; } final PsiElement parent = pattern.getParent(); final PsiElement victim = (parent instanceof RegExpGroup group && group.getType() == RegExpGroup.Type.NON_CAPTURING) ? parent : pattern; final String replacementText = buildReplacementText(pattern); if (replacementText == null) { return; } RegExpReplacementUtil.replaceInContext(victim, replacementText); }