code: private static int matchStringUntilLimitPart(
              MessagePattern pattern, int partIndex, int limitPartIndex,
              String source, int sourceOffset) {
          int matchingSourceLength = 0;
          String msgString = pattern.getPatternString();
          int prevIndex = pattern.getPart(partIndex).getLimit();
          for (;;) {
              Part part = pattern.getPart(++partIndex);
              if (partIndex == limitPartIndex || part.getType() == Part.Type.SKIP_SYNTAX) {
                  int index = part.getIndex();
                  int length = index - prevIndex;
                  if (length != 0 && !source.regionMatches(sourceOffset, msgString, prevIndex, length)) {
                      return -1;  // mismatch
                  }
                  matchingSourceLength += length;
                  if (partIndex == limitPartIndex) {
                      return matchingSourceLength;
                  }
                  prevIndex = part.getLimit();  // SKIP_SYNTAX
              }
          }
      }
docs: Matches the pattern string from the end of the partIndex to
  the beginning of the limitPartIndex,
  including all syntax except SKIP_SYNTAX,
  against the source string starting at sourceOffset.
  If they match, returns the length of the source string match.
  Otherwise returns -1.