void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); if (!REGEX_REPLACEMENT_METHODS.matches(expression)) { return; } final PsiExpression[] arguments = expression.getArgumentList().getExpressions(); final PsiExpression lastArgument = arguments[arguments.length - 1]; final Object value = ExpressionUtils.computeConstantExpression(lastArgument); if (!(value instanceof String string)) { return; } boolean escaped = false; for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); if (c == '\\') { escaped = !escaped; } else { if (escaped) { escaped = false; if (c == '$') continue; // $ needs escaping final TextRange range = ExpressionUtils.findStringLiteralRange(lastArgument, i - 1, i); if (range != null) { registerErrorAtOffset(lastArgument, range.getStartOffset(), range.getLength(), c, Boolean.TRUE); } else { registerError(lastArgument, c, Boolean.FALSE); return; } } } } }