code: static final int match(String text, int pos, String str) {
          for (int i = 0; i < str.length() && pos >= 0;) {
              int ch = UTF16.charAt(str, i);
              i += UTF16.getCharCount(ch);
              if (isBidiMark(ch)) {
                  continue;
              }
              pos = match(text, pos, ch);
              if (PatternProps.isWhiteSpace(ch)) {
                  i = skipPatternWhiteSpace(str, i);
              }
          }
          return pos;
      }
docs: Matches a string at text[pos] and return the index of the next character upon
  success. Return -1 on failure. Match a run of white space in str with a run of
  white space in text.