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


C# Match.NextMatch方法代码示例

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


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

示例1: Parse

 public static List<Node> Parse(ref Match m, string left, string right, string value)
 {
     List<Node> result;
     result = new List<Node>();
     while (m.Success)
     {
         // left, down
         if (m.Groups[left].Success)
         {
             m = m.NextMatch();
             Node tmp;
             tmp = new Node();
             tmp.Branches = Parse(ref m, left, right, value);
             result.Add(tmp);
         }
         else if (m.Groups[right].Success)
         {
             // right, up
             m = m.NextMatch();
             return result;
         }
         else if (m.Groups[value].Success)
         {
             // value, pluck
             Node tmp;
             tmp = new Node();
             tmp.Leaf = m.Groups[value].Value;
             result.Add(tmp);
             m = m.NextMatch();
         }
     }
     return result;
 }
开发者ID:quwahara,项目名称:Nana,代码行数:33,代码来源:Node.cs

示例2: BuildSelection

        private void BuildSelection(string content, FlowDocument selectionDoc, Match m)
        {
            var p = new Paragraph();
            int lastPosition = 0;
            while (m.Success)
            {
                p.Inlines.Add(new Run(content.Substring(lastPosition, m.Index)));
                p.Inlines.Add(new Bold(new Run(content.Substring(m.Index, m.Length))));
                lastPosition = m.Index + m.Length;

                if (!m.NextMatch().Success)
                {
                    p.Inlines.Add(new Run(content.Substring(lastPosition, content.Length - lastPosition)));
                }

                selectionDoc.Blocks.Add(p);

                m = m.NextMatch();
            }
        }
开发者ID:yaplex,项目名称:RegexMaster,代码行数:20,代码来源:Parser.cs

示例3: MatchViewModel

 protected MatchViewModel(Match model)
 {
     Model = model;
     var groups = model.Groups;
     var capture = model.Captures;// Capture has Index, Length, Value
     var index = model.Index;
     var length = model.Length;
     var next = model.NextMatch();
     var result = model.Result(stringg);
     var x = model.Success;
     var y = model.Value;
     groups[0].
开发者ID:vilinski,项目名称:vilinski.net,代码行数:12,代码来源:MatchViewModel.cs

示例4: ParseDelimiters

        private static string[] ParseDelimiters(Match match)
        {
            var delimiters = new List<string>();

            do
            {
                delimiters.Add(match.Groups["delimiter"].Value);
                match = match.NextMatch();
            }
            while (match.Success);

            return delimiters.ToArray();
        }
开发者ID:rhanekom,项目名称:katas,代码行数:13,代码来源:ExpressionParser.cs

示例5: GetTokenStringList

        public static List<string> GetTokenStringList(Match match, string token)
        {
            if (match.Success)
            {
                var matchList = new List<string>();

                matchList.Add(GetTokenString(match, token).Trim());

                do
                {
                    match = match.NextMatch();
                    matchList.Add(GetTokenString(match, token));
                } while (match.Success);

                return matchList;
            }
            return null;
        }
开发者ID:apavlo11356,项目名称:adamdotcom-services,代码行数:18,代码来源:RegexUtilities.cs

示例6: CompactRegexMatches

        public CompactRegexMatches(string input, Match match)
        {
            this.input = input;
            this.found = false;
            List<CompactRegexMatch> matchList = new List<CompactRegexMatch>();
            while (match.Success)
            {
                this.found = true;
                CompactRegexMatch regexMatch = new CompactRegexMatch();
                regexMatch.value = match.Value;
                bool firstGroup = true;
                bool secondGroup = true;
                StringBuilder sb = new StringBuilder();
                foreach (Group group in match.Groups)
                {
                    if (firstGroup)
                    {
                        firstGroup = false;
                        continue;
                    }

                    if (!secondGroup)
                        sb.Append(' ');
                    secondGroup = false;
                    sb.Append('(');

                    bool firstCapture = true;
                    foreach (Capture capture in group.Captures)
                    {
                        if (!firstCapture)
                            sb.Append(", ");
                        sb.AppendFormat("\"{0}\"", capture.Value);
                        firstCapture = false;
                    }
                    sb.Append(')');
                }
                regexMatch.groups = sb.ToString();
                matchList.Add(regexMatch);
                match = match.NextMatch();
            }
            matches = matchList.ToArray();
        }
开发者ID:labeuze,项目名称:source,代码行数:42,代码来源:Test_Unit_Regex.cs

示例7: ReadEntity

 private void ReadEntity()
 {
     matchEnts = regexEnts.Match(content);
     while (matchEnts.Success)
     {
         CBEntity.Items.Add(matchEnts.Groups[1].Value.ToString());
         matchEnts = matchEnts.NextMatch();
     }
     if (CBEntity.Items.Count > 0)
     {
         CBEntity.SelectedIndex = CBEntity.Items.Count - 1;
         CBEntity.IsEnabled = true;
         BOk.IsEnabled = true;
     }
     else
     {
         MessageBox.Show("Entity не обнаружены.");
         CBEntity.IsEnabled = false;
         BOk.IsEnabled = false;
     }
 }
开发者ID:okunokao,项目名称:GEoS,代码行数:21,代码来源:FormImportVhdl.xaml.cs

示例8: showNextAppTime

        public void showNextAppTime()
        {
            string county = form1.selecteCounty.Shops[form1.selectedShop];        //big surprise!!! the official entrance is the encoding with s-jis of county's name, BUT, shop's name also works! And now I use shop's name with others' will narely do

            string shop = form1.selecteCounty.Sids[form1.selectedShop];
            string forTest = Form1.ToUrlEncode(
                        county,
                        System.Text.Encoding.GetEncoding("shift-jis")
                     );

            DateTime dateTime = DateTime.MinValue;
            string day = "";
            string time = "";

            string html = Form1.weLoveYue(
                form1,
                "http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2="
                + Form1.ToUrlEncode(
                        county,
                        System.Text.Encoding.GetEncoding("shift-jis")
                     )
                + "&event_type=" + sizeType + "&sid=" + shop + "&kmws=",

                "GET", "", false, "", ref  cookieContainer,
                false
                );

            //available
            //   <th>予約受付期間</th>
            //					<td>
            //						10/12<font color="#ff0000">(月)</font>&nbsp;13:30~10/12<font color="#ff0000">(月)</font>&nbsp;22:00<br />

            if (county == form1.selecteCounty.Shops[form1.selectedShop]
                && shop == form1.selecteCounty.Sids[form1.selectedShop]
                && sizeType == form1.selectedType)
            {
                rgx = @"(?<=<th>予約受付期間</th>\n.*\n\s*)\d+\/\d+(?=\D)";
                myMatch = (new Regex(rgx)).Match(html);
                while (myMatch.Success)
                {
                    day = myMatch.Groups[0].Value;// no available appointment
                    rgx = @"(?<=<th>予約受付期間</th>\n.*\n\s*" + day + @"(\s|\S)+?)\d+\:\d+(?=\D)";
                    Match match2 = (new Regex(rgx)).Match(html);
                    if (match2.Success)
                    {
                        time = match2.Groups[0].Value;

                        DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
                        dtFormat.ShortDatePattern = "yyyy-M-d hh:mm:ss";
                        dateTime = Convert.ToDateTime("2015-" + Regex.Match(day, @"\d+(?=\/)") + "-" + Regex.Match(day, @"(?<=\/)\d+") + " " + time + ":00");

                        //how to find the year ?

                        TimeZoneInfo jst = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
                        TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
                        DateTime nowInTokyoTime = TimeZoneInfo.ConvertTime(DateTime.Now, jst);
                        if ((dateTime - nowInTokyoTime).TotalMinutes > -15)
                        {
                            delegate2 d111 = new delegate2(
                                delegate() {
                                    form1.label14.Text = "the nearest booking on type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county
                                    + " is on: \n" + dateTime.ToString("MM/dd HH:mm") + " Tokyo Standard Time\n"
                                    + TimeZoneInfo.ConvertTimeFromUtc(TimeZoneInfo.ConvertTimeToUtc(dateTime, jst), cst).ToString("MM/dd HH:mm")
                                    + " China Standard Time"
                                    ;
                                 }
                            );
                            form1.label14.Invoke(d111);
                            return;
                        }
                    }
                    myMatch = myMatch.NextMatch();
                }
                delegate2 d222 = new delegate2(
                    delegate() {
                        if (Regex.Match(html, @"条件に一致する予約販売が存在しません").Success)
                        {
                            form1.label14.Text = "There is no type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county;
                        }
                        else
                        {
                            form1.label14.Text = "No available booking these days on type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county;
                        }
                    }
                );
                form1.label14.Invoke(d222);
            }//end of if the search option not changed
        }
开发者ID:daiyyr,项目名称:witkeyPaperDiaper,代码行数:88,代码来源:PaperDiaper.cs

示例9: OnFieldMatch

 protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
 {
     while (match.Success)
     {
         if (context.SourceHeaderInfo.ContainsKey(match.Groups[1].Value))
             context.FieldBuffer[context.SourceHeaderInfo[match.Groups[1].Value]] = match.Groups[2].Value;
         match = match.NextMatch();
     }
     return NextInstruction.Return;
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:10,代码来源:FortigateUnifiedRecorder.cs

示例10: EnumerateMatches

        private static IEnumerable<Match> EnumerateMatches(Match match, int count)
        {
            while (match.Success)
            {
                yield return match;

                count--;

                if (count == 0)
                    yield break;

                match = match.NextMatch();
            }
        }
开发者ID:JosefPihrt,项目名称:LinqToRegex,代码行数:14,代码来源:RegexSplit.cs

示例11: EnumerateMatchesRightToLeft

        private static IEnumerable<Match> EnumerateMatchesRightToLeft(Match match, int count)
        {
            var matches = new List<Match>();

            while (match.Success)
            {
                matches.Add(match);

                count--;

                if (count == 0)
                    break;

                match = match.NextMatch();
            }

            for (int i = matches.Count - 1; i >= 0; i--)
                yield return matches[i];
        }
开发者ID:JosefPihrt,项目名称:LinqToRegex,代码行数:19,代码来源:RegexSplit.cs

示例12: while

        private static List<IIMDbSearchResult> MultipleMatchesAddToSearchResults
            (Match match, IMDbRegEx imDbRegex, List<IIMDbSearchResult> results)
        {

            while (match != null && match.Length > 0)
            {


                var result = IMDbConventionalFilmSearchEngineHelpers
                    .MultipleMatchesMineDetailsOfSingleFilmResult(match, imDbRegex);


                IMDbConventionalFilmSearchEngineHelpers
                    .IgnoreIrrelevantResults
                    (match, imDbRegex, result);


                results.Add(result);
                
                Debugger.LogMessageToFile
                    ("[IMDb Conventional Film Search Engine] " +
                     "Result was added to list.");
                
                match = match.NextMatch();
                
                Debugger.LogMessageToFile
                    ("[IMDb Conventional Film Search Engine]" +
                     " Proceeding to next result...");
            
            }




          return results;
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:36,代码来源:IMDbConventionalFilmSearchEngine.cs

示例13: OnFieldMatch

 protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
 {
     if (!match.Success) return NextInstruction.Skip;
     var datetime = false;
     while (match.Success)
     {
         if (!datetime) context.FieldBuffer[context.SourceHeaderInfo["Datetime"]] = match.Groups["Datetime"].Value;
         datetime = true;
         if (context.SourceHeaderInfo.ContainsKey(match.Groups[5].Value))
             context.FieldBuffer[context.SourceHeaderInfo[match.Groups[5].Value]] = match.Groups[8].Value;
         match = match.NextMatch();
     }
     return NextInstruction.Return;
 }
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:14,代码来源:KerioMailUnifiedRecorder.cs

示例14: FillMatchesArrayAllPatternOrder

		/// <summary>
		/// Goes through <paramref name="m"/> matches and fill <paramref name="matches"/> array with results
		/// according to Pattern Order.
		/// </summary>
		/// <param name="r"><see cref="Regex"/> that produced the match</param>
		/// <param name="m"><see cref="Match"/> to iterate through all matches by NextMatch() call.</param>
		/// <param name="matches">Array for storing results.</param>
		/// <param name="addOffsets">Whether or not add arrays with offsets instead of strings.</param>
		/// <returns>Number of full pattern matches.</returns>
		private static int FillMatchesArrayAllPatternOrder(Regex r, Match m, ref PhpArray matches, bool addOffsets)
		{
			// second index, increases at each match in pattern order
			int j = 0;
			while (m.Success)
			{
				// add all groups
				for (int i = 0; i < m.Groups.Count; i++)
				{
					object arr = NewArrayItem(m.Groups[i].Value, m.Groups[i].Index, addOffsets);

                    AddGroupNameToResult(r, matches, i, (ms, groupName) =>
                    {
                        if (j == 0) ms[groupName] = new PhpArray();
                        ((PhpArray)ms[groupName])[j] = arr;
                    });

					if (j == 0) matches[i] = new PhpArray();
					((PhpArray)matches[i])[j] = arr;
				}

				j++;
				m = m.NextMatch();
			}

			return j;
		}
开发者ID:proff,项目名称:Phalanger,代码行数:36,代码来源:RegExpPerl.cs

示例15: DetailRegexMatches

 public DetailRegexMatches(string input, Match match)
 {
     this.input = input;
     this.found = false;
     List<DetailRegexMatch> matchList = new List<DetailRegexMatch>();
     while (match.Success)
     {
         this.found = true;
         DetailRegexMatch regexMatch = new DetailRegexMatch();
         regexMatch.indexMatch = match.Index;
         regexMatch.lengthMatch = match.Length;
         regexMatch.value = match.Value;
         List<DetailRegexGroup> groupList = new List<DetailRegexGroup>();
         foreach (Group group in match.Groups)
         {
             DetailRegexGroup regexGroup = new DetailRegexGroup();
             regexGroup.indexMatch = group.Index;
             regexGroup.lengthMatch = group.Length;
             regexGroup.value = group.Value;
             List<DetailRegexCapture> captureList = new List<DetailRegexCapture>();
             foreach (Capture capture in group.Captures)
             {
                 DetailRegexCapture regexCapture = new DetailRegexCapture();
                 regexCapture.indexMatch = capture.Index;
                 regexCapture.lengthMatch = capture.Length;
                 regexCapture.value = capture.Value;
                 captureList.Add(regexCapture);
             }
             regexGroup.captures = captureList.ToArray();
             groupList.Add(regexGroup);
         }
         regexMatch.groups = groupList.ToArray();
         matchList.Add(regexMatch);
         match = match.NextMatch();
     }
     matches = matchList.ToArray();
 }
开发者ID:labeuze,项目名称:source,代码行数:37,代码来源:Test_Unit_Regex.cs


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