void (RegExpChar aChar) { if (!isSpace(aChar) || isSpace(aChar.getPrevSibling()) || isInEscapeSequence(aChar)) { return; } final PsiElement parent = aChar.getParent(); if (parent instanceof RegExpClass || parent instanceof RegExpCharRange) { return; } int count = 1; int length = aChar.getTextLength(); PsiElement next = aChar.getNextSibling(); while (isSpace(next)) { count++; length += next.getTextLength(); next = next.getNextSibling(); } if (count > 1) { final String message = RegExpBundle.message("inspection.warning.consecutive.spaces.in.regexp", count); final int offset = aChar.getStartOffsetInParent(); myHolder.registerProblem(parent, new TextRange(offset, offset + length), message, new RepeatedSpaceFix(count)); } }