当前位置: 首页>>代码示例>>C#>>正文


C# Match.AddMatch方法代码示例

本文整理汇总了C#中System.Text.RegularExpressions.Match.AddMatch方法的典型用法代码示例。如果您正苦于以下问题:C# Match.AddMatch方法的具体用法?C# Match.AddMatch怎么用?C# Match.AddMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Text.RegularExpressions.Match的用法示例。


在下文中一共展示了Match.AddMatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransferCapture

 /// <summary>
 /// Transfers a Capture to a Match
 /// </summary>
 /// <param name="match"></param>
 /// <param name="capnum"></param>
 /// <param name="uncapnum"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 internal void TransferCapture(Match match, int capnum, int uncapnum, int start, int end)
 {
     if (end < start)
     {
         int numx = end;
         end = start;
         start = numx;
     }
     int num = match.MatchIndex(uncapnum);
     int num2 = match.MatchLength(uncapnum);
     if (start >= num2)
     {
         end = start;
         start = num2;
     }
     else if (end <= num)
     {
         start = num;
     }
     else
     {
         if (end > num2)
         {
             end = num2;
         }
         if (num > start)
         {
             start = num;
         }
     }
     //this.Crawl(uncapnum);
     match.BalanceMatch(uncapnum);
     if (capnum != -1)
     {
         //this.Crawl(capnum);
         match.AddMatch(capnum, start, end - start);
     }
 }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:46,代码来源:Regex.cs

示例2: Match

 /// <summary>
 /// Searches the specified input string for the first occurrence of the specified regular expression.
 /// </summary>
 /// <param name="input">The input string to match at</param>
 /// <param name="beginning">The place to start matching</param>
 ///<param name="length">NOT YET USED</param>
 /// <returns>The Match resulting from the input against the compiled pattern</returns>
 internal Match Match(string input, int beginning, int length)
 {            
     //Sanity checks
     if(beginning < 0 || beginning > input.Length) throw new ArgumentException("beginning");
     //Set timing flag
     //If the RegexOption is set OR the timed flag passed
     this.timed = (this.Options & RegexOptions.Timed) == RegexOptions.Timed;
     //Attempt a match
     Match result = RegularExpressions.Match.Empty;            
     if (IsMatch(input, beginning))
     {
         result = new Match(this, matchCount, input, start0, end0 - start0, beginning);
         //Must call AddMatch to ensure the start and ends are allocated to result.groups[i].caps
         for(int i = 0; i < matchCount; ++i)
         {
             int start = GroupStart(i), end = GroupEnd(i), len = end - start;
             result.AddMatch(i, start, len);
         }
         //Clean up the result using the members calculated when AddMatch was called
         result._index = result._matches[0][0];
         result._length = result._matches[0][1];                            
         result._capcount = result._matchcount[0];
         //Set the position of the result which is the end of the first subexpression
         //subsequent matches will proceed from this index
         result._textpos = end0;    
     }
     return result;
 }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:35,代码来源:Regex.cs

示例3: Capture

 /// <summary>
 /// Adds a match to a Match
 /// </summary>
 /// <param name="capnum"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 internal void Capture(Match match, int capnum, int start, int end)
 {
     if (end < start)
     {
         int num = end;
         end = start;
         start = num;
     }
     //this.Crawl(capnum);
     match.AddMatch(capnum, start, end - start);
 }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:17,代码来源:Regex.cs


注:本文中的System.Text.RegularExpressions.Match.AddMatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。