private static StringPointer matchCapture ( MatchState ms, StringPointer s, int ll ) {
        int l = checkCapture ( ms, ll );
        int len = ms.capture[l].len;
        if ( ( ms.endIndex - s.length () ) >= len && ms.capture[l].init.compareTo(s, len) == 0 ) {
            StringPointer sp = s.getClone();
            sp.postIncrString ( len );
            return sp;
        }
        else {
            return null;
        }
    }
Only works with non-negative numbers
main/src/main/java/cgeo/geocaching/wherigo/kahlua/stdlib/StringLib.java