void (PsiElement regex) { String[] parts; if (regex instanceof GrRegex) { parts = ((GrRegex)regex).getTextParts(); } else { parts = new String[]{regex.getFirstChild().getNextSibling().getText()}; } for (String part : parts) { if (!GrStringUtil.parseRegexCharacters(part, new StringBuilder(part.length()), null, regex.getText().startsWith("/"))) { myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("illegal.escape.character.in.string.literal")).range(regex).create(); return; } } }