boolean (PsiElement element, String text) { if (text.startsWith("\\") && text.length() >= 4) { char escapedChar = text.charAt(1); PsiElement context = InjectedLanguageManager.getInstance(element.getContainingFile().getProject()).getInjectionHost(element.getContainingFile()); if (context != null && context.textContains(escapedChar) && context.getText().startsWith(String.valueOf(escapedChar)) && text.endsWith("\\"+escapedChar) ) { return true; } } return false; }