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


C# RegularExpressions.GroupCollection类代码示例

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


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

示例1: TestCondition

        public static bool TestCondition(string variable, string condition, bool noCase, out GroupCollection groupCollection)
        {
            groupCollection = null;

            // negate condition ?
            var negate = false;
            if (condition.StartsWith("!")) {
                negate = true;
                condition = condition.Substring(1);
            }

            if (condition.StartsWith("=")) {
                condition = condition.Substring(1);
                return negate ^
                       String.Equals(variable, condition,
                                     noCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
            }

            if (condition.StartsWith("<")) {
                condition = condition.Substring(1);
                return negate ^ String.CompareOrdinal(variable, condition) == -1;
            }

            if (condition.StartsWith(">")) {
                condition = condition.Substring(1);
                return negate ^ String.CompareOrdinal(variable, condition) == 1;
            }

            // otherwise it's a regular expression
            var match = Regex.Match(variable, condition, noCase ? RegexOptions.IgnoreCase : RegexOptions.None);
            groupCollection = match.Groups;
            return negate ^ match.Success;
        }
开发者ID:robertbird,项目名称:BoomJennies,代码行数:33,代码来源:RulesInterpreter.cs

示例2: GetValues

 protected virtual IEnumerable<string> GetValues(GroupCollection groups)
 {
     for (var i = 1; i < groups.Count; i++)
     {
         yield return groups[i].Value;
     }
 }
开发者ID:hlaueriksson,项目名称:LoneWolfMigration,代码行数:7,代码来源:GeneratorBase.cs

示例3: ExtraVideoMatch

        protected override void ExtraVideoMatch(VideoInfo video, GroupCollection matchGroups)
        {

            TrackingInfo ti = new TrackingInfo();

            // for southpark world
            System.Text.RegularExpressions.Group epGroup = matchGroups["Episode"];
            if (epGroup.Success)
                ti.Regex = Regex.Match(epGroup.Value, @"(?<Season>\d\d)(?<Episode>\d\d)");

            // for nl and de
            if (ti.Season == 0)
                ti.Regex = Regex.Match(video.VideoUrl, @"\/S(?<Season>\d{1,3})E(?<Episode>\d{1,3})-", RegexOptions.IgnoreCase);

            if (ti.Season != 0)
            {
                ti.Title = "South Park";
                ti.VideoKind = VideoKind.TvSeries;
                video.Other = new VideoInfoOtherHelper() { TI = ti };
            }
            else
                video.Other = new VideoInfoOtherHelper();
            int time;
            if (Int32.TryParse(video.Airdate, out time))
            {
                video.Airdate = epoch.AddSeconds(time).ToString();
            }
        }
开发者ID:flanagan-k,项目名称:mp-onlinevideos2,代码行数:28,代码来源:SouthParkUtil.cs

示例4: SetScorePosition

        private void SetScorePosition(IScore score, GroupCollection parts)
        {
            var offset = string.IsNullOrEmpty(parts[2].Value) ? parts[1].Length : Convert.ToInt32(parts[2].Value);
            var timing = parts[1].Value.Last() == '\\' ? OffsetTiming.Early : OffsetTiming.Late;

            score.SetPosition(timing == OffsetTiming.Early ? -offset : offset);
        }
开发者ID:robbell,项目名称:drum-score,代码行数:7,代码来源:OffsetSampleExpression.cs

示例5: AddPeople

		private void AddPeople(string groupName, string singular, string plural, StringBuilder sb, GroupCollection groups) {
			if (groups[groupName].Success) {
				if (sb.Length != 0) sb.AppendLine();
				string people=htmlRx.Replace(groups[groupName].Value, string.Empty);
				sb.Append(people.Contains(",") ? plural:singular).Append(people);
			}
		}
开发者ID:drdax,项目名称:Radio,代码行数:7,代码来源:EchoGuide.cs

示例6: SetStackTraceFilePosition

		void SetStackTraceFilePosition(GroupCollection groups)
		{
			string fileName = groups[1].Value;
			int line = Convert.ToInt32(groups[2].Value);
			int column = 1;
			
			StackTraceFilePosition = new FilePosition(fileName, line, column);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:8,代码来源:PythonTestResult.cs

示例7: GetValues

        protected override IEnumerable<string> GetValues(GroupCollection groups)
        {
            for (var i = 1; i < groups.Count; i++)
            {
                if (groups[i].Success) return new[] {groups[i].Value};
            }

            return new string[0];
        }
开发者ID:hlaueriksson,项目名称:LoneWolfMigration,代码行数:9,代码来源:Weapon.cs

示例8: ConvertRegexGroupsToArray

 private static string[] ConvertRegexGroupsToArray(GroupCollection groups)
 {
     var ret = new string[groups.Count - 1];
     for (var i = 1; i < groups.Count; i++)
     {
         ret[i - 1] = groups[i].Value;
     }
     return ret.Where(x => !String.IsNullOrWhiteSpace(x)).ToArray(); // HACK: This should be changed in the Regex behaviour and this hack should be removed (wait for internet to see the best way)
 }
开发者ID:micheledicosmo,项目名称:retrotwitter,代码行数:9,代码来源:CommandCreatorsFactory.cs

示例9: SelectValue

 private int SelectValue( GroupCollection groups, ref string str )
 {
     int q = 4;
       do {
     str = groups[ q ].Value;
     q += 2;
       } while( q <= 8 && str.Length == 0 );
       return q - 2;
 }
开发者ID:KoMaTo3,项目名称:csgl,代码行数:9,代码来源:TextParser.cs

示例10: GetParameters

        private static DynamicDictionary GetParameters(Regex regex, GroupCollection groups)
        {
            dynamic data = new DynamicDictionary();

            for (var i = 1; i <= groups.Count; i++)
            {
                data[regex.GroupNameFromNumber(i)] = groups[i].Value;
            }

            return data;
        }
开发者ID:UStack,项目名称:UWeb,代码行数:11,代码来源:DefaultRoutePatternMatcher.cs

示例11: GetParameters

        private static DynamicDictionary GetParameters(Regex regex, GroupCollection groups)
        {
            dynamic data = new DynamicDictionary();

            for (int i = 1; i <= groups.Count; i++)
            {
                data[regex.GroupNameFromNumber(i)] = Uri.UnescapeDataString(groups[i].Value);
            }

            return data;
        }
开发者ID:nathanpalmer,项目名称:Nancy,代码行数:11,代码来源:DefaultRoutePatternMatcher.cs

示例12: Match

		private Match (Regex regex, IMachine machine,
						GroupCollection groups,
						string text, int text_length,
						int index, int length, int n_caps)
			: base (text, index, length, n_caps) {
			this.regex = regex;
			this.machine = machine;
			this.text_length = text_length;

			this.groups = groups;
			groups.SetValue (this, 0);
		}
开发者ID:carrie901,项目名称:mono,代码行数:12,代码来源:Match.jvm.cs

示例13: AddToList

        private void AddToList(GroupCollection groups, List<string> values, string[] ignoreValues)
        {
            string key = groups["name"].Value;
            string value = groups["value"].Value;

            if (!String.IsNullOrEmpty(key) && !String.IsNullOrEmpty(value))
            {
                string valueToAdd = String.Format("{0}={1}", key, HttpUtility.UrlEncode(value));
                if (ignoreValues == null || Array.IndexOf(ignoreValues, valueToAdd) == -1)
                    values.Add(valueToAdd);
            }
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:12,代码来源:MyHosterBase.cs

示例14: Add

 private void Add(GroupCollection g, string category, IDictionary<string, double> externalDictionary, string success, string fail)
 {
     var number = g[1].Value;
       var unit = g[2].Value;
       var wordToAdd = g[3].Value;
       var duration = BanTime(number, unit);
       if (!category.Contains("Regex")) wordToAdd = wordToAdd.ToLower();
       if (Datastore.AddToStateString(category, wordToAdd, duration.TotalSeconds, externalDictionary))
     Send(wordToAdd + success);
       else
     Send(wordToAdd + fail + Tools.PrettyDeltaTime(duration));
 }
开发者ID:destinygg,项目名称:bot,代码行数:12,代码来源:ModCommander.cs

示例15: DevNamesFrom

 private static IEnumerable<string> DevNamesFrom(GroupCollection groups)
 {
     int skip = 1;
     foreach (Group @group in groups)
     {
         if (skip > 0)
         {
             skip--;
             continue;
         }
         yield return @group.Value;
     }
 }
开发者ID:adrianoc,项目名称:binboo,代码行数:13,代码来源:PairCommandTestCase.Helper.cs


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