void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof PsiLiteralExpression expression)) { return; } final String text = expression.getText(); final StringBuilder newExpression = new StringBuilder(); int length = text.length(); for (int i = 0; i < length; i++) { char c = text.charAt(i); if (StringUtil.containsChar(REGEX_META_CHARS, c)) { newExpression.append("\\\\"); } newExpression.append(c); } PsiReplacementUtil.replaceExpression(expression, newExpression.toString()); }