diff --git a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java
index f6f0bddc28f9..905953df927c 100644
--- a/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java
+++ b/RegExpSupport/src/org/intellij/lang/regexp/validation/RegExpAnnotator.java
@@ -290,7 +290,8 @@ public final class RegExpAnnotator extends RegExpElementVisitor implements Annot
}
final RegExpGroup group = groupRef.resolve();
if (group == null) {
- final Annotation a = myHolder.createErrorAnnotation(groupRef, "Unresolved named group reference");
+ final ASTNode node = groupRef.getNode().findChildByType(RegExpTT.NAME);
+ final Annotation a = myHolder.createErrorAnnotation(node, "Unresolved named group reference");
if (a != null) {
// IDEA-9381
a.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
diff --git a/RegExpSupport/testData/RETest.xml b/RegExpSupport/testData/RETest.xml
index e64e50e8d5b4..d2c31f74fb94 100644
--- a/RegExpSupport/testData/RETest.xml
+++ b/RegExpSupport/testData/RETest.xml
@@ -76,7 +76,7 @@
OK
- \k]]>
+ adsf>]]>
OK