System.Text.RegularExpressions.Match.AddMatch C# (CSharp) Method

AddMatch() private method

private AddMatch ( int cap, int start, int len ) : void
cap int
start int
len int
return void
        internal virtual void AddMatch(int cap, int start, int len)
        {
            int capcount;

            if (_matches[cap] == null)
                _matches[cap] = new int[2];

            capcount = _matchcount[cap];

            if (capcount * 2 + 2 > _matches[cap].Length)
            {
                int[] oldmatches = _matches[cap];
                int[] newmatches = new int[capcount * 8];
                for (int j = 0; j < capcount * 2; j++)
                    newmatches[j] = oldmatches[j];
                _matches[cap] = newmatches;
            }

            _matches[cap][capcount * 2] = start;
            _matches[cap][capcount * 2 + 1] = len;
            _matchcount[cap] = capcount + 1;
        }

Usage Example

Example #1
0
        // Called by Go() to capture a subexpression. Note that the
        // capnum used here has already been mapped to a non-sparse
        // index (by the code generator RegexWriter).
        //| <include file='doc\RegexRunner.uex' path='docs/doc[@for="RegexRunner.Capture"]/*' />
        protected void Capture(int capnum, int start, int end)
        {
            if (end < start)
            {
                int T;

                T     = end;
                end   = start;
                start = T;
            }

            Crawl(capnum);
            runmatch.AddMatch(capnum, start, end - start);
        }
All Usage Examples Of System.Text.RegularExpressions.Match::AddMatch