• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RegularExpressions.GroupCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddNewAlias

        public static void AddNewAlias(GroupCollection aliasGroup)
        {
            string aliasName = aliasGroup[1].ToString();
            SteamID steamID = (SteamID) UInt64.Parse(aliasGroup[2].ToString());

            StreamWriter sw = File.AppendText("alias_list.txt");

            sw.WriteLine("{0}:{1}", aliasName, steamID.ConvertToUInt64());

            sw.Close();

            Roulette.BuildAliasList();
        }
开发者ID:ZacMillionaire,项目名称:RapscallionSharp,代码行数:13,代码来源:ChatCommander.cs


示例17: InitializeParams

 internal void InitializeParams(GroupCollection groups)
 {
     int iterator = 0;
     foreach (Group group in groups)
     {
         if (iterator != 0)
         {
             foreach (Capture capture in group.Captures)
             {
                 parameters.Set(capture.Value, iterator - 1);
             }
         }
         iterator++;
     }
 }
开发者ID:oivoodoo,项目名称:RS485_Network_Demo_Library,代码行数:15,代码来源:ProtocolToken.cs


示例18: Match

        internal Match(string text, Matcher matcher, Regex regex, int start)
            : base(text, start, start)
        {
            this.matcher = matcher;
            this.regex = regex;

            bool success = matcher.Find(start);
            if (success)
            {
                UpdateRegion(matcher.Start(), matcher.End());
                groupCollection = new GroupCollection(text, matcher, this);  
            }
            else
            {
                UpdateRegion(-1, -1);
            }
        }
开发者ID:nguyenkien,项目名称:api,代码行数:17,代码来源:Match.cs


示例19: ResultFileNameFromPatterns

        private static string ResultFileNameFromPatterns( string[] patterns, GroupCollection parts )
        {
            var rslt = new System.Text.StringBuilder();
            var ptr_parts = new List<string[]>();
            for( int i = 0; i < patterns.Length; ++i )
                ptr_parts.Add(patterns[i].Split('*'));

            int ptr_part_num = ptr_parts[0].Length;
            for( int i = 0; i < ptr_part_num; ++i )
            {
                if( i > 0 )
                    rslt.Append(parts[i].Value);

                rslt.Append(string.Join(string.Empty, ptr_parts.Select(ptrs => ptrs[i]).Distinct()));
            }

            return rslt.ToString();
        }
开发者ID:mqrelly,项目名称:ColorChannelMixer,代码行数:18,代码来源:MatchingFileNames.cs


示例20: httpBodyInfoHandle

        public void httpBodyInfoHandle(HttpListenerContext context, GroupCollection url)
        {
            try {
                HttpListenerResponse response = context.Response;
                CelestialBody body = KerbalGIS.findBody (url [1].Value);
                if (body == null || body.BiomeMap.Attributes.Length <= 1) {
                    httpError (context);
                    return;
                }

                string ret = Info.getJSONInfo (body);

                response.StatusCode = 200;
                response.ContentType = "application/json";
                response.Close (Encoding.UTF8.GetBytes (ret), false);
            } catch (Exception e) {
                Debug.LogException (e);
            }
        }
开发者ID:Gnonthgol,项目名称:KerbalGIS,代码行数:19,代码来源:HTTPServer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RegularExpressions.Match类代码示例发布时间:2022-05-26
下一篇:
C# RegularExpressions.Group类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap