RegExpGroup (int index, PsiFile file) { if (index < 0) { return resolveRelativeGroup(Math.abs(index), file); } return SyntaxTraverser.psiTraverser(file) .filter(RegExpGroup.class) .filter(RegExpGroup::isCapturing) .skip(index - 1) .first(); }