private static int handleRegExp(int index, @NotNull String criteria, @NotNull MatchVariableConstraint constraint) {
    final int length = criteria.length();
    int endIndex = index;
    while (endIndex < length && !Character.isWhitespace(criteria.charAt(endIndex))) {
      ++endIndex;
    }

    if (endIndex == index) {
      if (criteria.charAt(index - 1) == ':') {
        throw new MalformedPatternException(SSRBundle.message("error.expected.condition", ":"));
      }
      else {
        return endIndex;
      }
    }
    final String regexp = criteria.substring(index, endIndex);

    if (!constraint.getRegExp().isEmpty() && !constraint.getRegExp().equals(regexp)) {
      throw new MalformedPatternException(SSRBundle.message("error.two.different.type.constraints"));
    }
    else {
      checkRegex(regexp);
      constraint.setRegExp(regexp);
    }

    return endIndex;
  }
private static int handleRegExp(int index, @NotNull String criteria, @NotNull MatchVariableConstraint constraint)