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


C# Regex.Result方法代码示例

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


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

示例1: FromAssemblyName

 public static AssemblyIdentity FromAssemblyName(string assemblyName)
 {
     Match match = new Regex("^(?<name>[^,]*)(, Version=(?<version>[^,]*))?(, Culture=(?<culture>[^,]*))?(, PublicKeyToken=(?<pkt>[^,]*))?(, ProcessorArchitecture=(?<pa>[^,]*))?(, Type=(?<type>[^,]*))?").Match(assemblyName);
     string name = match.Result("${name}");
     string version = match.Result("${version}");
     string publicKeyToken = match.Result("${pkt}");
     string culture = match.Result("${culture}");
     string processorArchitecture = match.Result("${pa}");
     return new AssemblyIdentity(name, version, publicKeyToken, culture, processorArchitecture, match.Result("${type}"));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:AssemblyIdentity.cs

示例2: Search

 public override void Search()
 {
     string langStr = TextMiningUtils.GetLanguageCode(mLanguage);
     mResultSet.Inner.Clear();
     if (mCache == null || !mCache.GetFromCache("GoogleDefine", mLanguage, mQuery, mResultSetMaxSz, ref mTotalHits, ref mResultSet))
     {
         int i = 0;
         string defHtml = WebUtils.GetWebPage(string.Format("http://www.google.com/search?defl={0}&q=define%3A{1}", langStr, HttpUtility.UrlEncode(mQuery))); // throws WebException
         Match defMatch = new Regex("<li>(?<def>[^<]*)(<br><a href=\"(?<href>[^\"]*))?", RegexOptions.Singleline).Match(defHtml);
         while (defMatch.Success)
         {
             string def = HttpUtility.HtmlDecode(defMatch.Result("${def}").Trim());
             string href = defMatch.Result("${href}");
             string url = null;
             Match matchUrl = new Regex("&q=(?<url>[^&]*)").Match(href);
             if (matchUrl.Success) { url = HttpUtility.UrlDecode(matchUrl.Result("${url}")); }
             mResultSet.Inner.Add(new SearchEngineResultItem(mQuery, def, url, ++i));
             defMatch = defMatch.NextMatch();
         }
         string lastUrl = null;
         for (int j = mResultSet.Count - 1; j >= 0; j--)
         {
             if (mResultSet[j].Url == null) { mResultSet[j].SetUrl(lastUrl); }
             else { lastUrl = mResultSet[j].Url; }
         }
         mTotalHits = mResultSet.Count;
         if (mCache != null)
         {
             mCache.PutIntoCache("GoogleDefine", mLanguage, mQuery, mTotalHits, mResultSet);
         }
         if (mResultSetMaxSz < mResultSet.Count)
         {
             mResultSet.Inner.RemoveRange(mResultSetMaxSz, mResultSet.Count - mResultSetMaxSz);
         }
     }
 }
开发者ID:project-first,项目名称:latino,代码行数:36,代码来源:GoogleDefine.cs

示例3: ParseTable

		protected virtual void ParseTable (string table)
		{
			int start = table.IndexOf ('}')+1;
			Match m = new Regex (regex_table, RegexOptions.Compiled).Match (table);
			
			ParseRows (table.Substring (start, table.Length-start-1), m.Result ("${ns}"), m.Result ("${tbl}"));
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:Mork.cs

示例4: Add

 protected override ObjectWithId Add(DataTransferObject dto)
 {
     LocalAddressDTO sdto = (LocalAddressDTO) dto;
     if ((sdto.Level == AddressLevel.Дом) || (sdto.Level == AddressLevel.MaxAddress))
     {
         Match match = new Regex(@"^(?<from>\d+)-(?<to>\d+)$").Match(sdto.Name);
         if (match.get_Success())
         {
             int num;
             int num2;
             if (!int.TryParse(match.Result("${from}"), ref num) || !int.TryParse(match.Result("${to}"), ref num2))
             {
                 throw new System.ApplicationException("Ошибка при преобразовании номера в целочисленный тип");
             }
             sdto.Name = ((int) num).ToString();
             sdto.NameTo = ((int) num2).ToString();
             System.Collections.Generic.List<LocalAddress> list = this.ParentAddress.AddLocalAddressRange(sdto);
             Messages.ShowMessage("Для отображения всего списка обновите родительский адрес");
             return list.get_Item(0);
         }
     }
     return this.ParentAddress.AddLocalAddress(sdto);
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:23,代码来源:AddressView.cs

示例5: ReadFeatureVectors

 private static List<int> ReadFeatureVectors(StreamReader reader)
 {
     string line;
     List<int> feature_vectors = new List<int>();
     while ((line = reader.ReadLine()) != null)
     {
         if (!line.StartsWith("#"))
         {
             Match label_match = new Regex(@"^(?<label>[+-]?\d+([.]\d+)?)(\s|$)").Match(line);
             Debug.Assert(label_match.Success);
             int label = Convert.ToInt32(label_match.Result("${label}"));
             Match match = new Regex(@"(?<feature>\d+):(?<weight>[-]?[\d\.]+)").Match(line);
             List<int> features = new List<int>();
             List<float> weights = new List<float>();
             while (match.Success)
             {
                 int feature = Convert.ToInt32(match.Result("${feature}"));
                 float weight = Convert.ToSingle(match.Result("${weight}"), System.Globalization.CultureInfo.InvariantCulture);
                 match = match.NextMatch();
                 features.Add(feature);
                 weights.Add(weight);
             }
             int vec_id = SvmLightLib.NewFeatureVector(features.Count, features.ToArray(), weights.ToArray(), label);
             feature_vectors.Add(vec_id);
         }
     }
     return feature_vectors;
 }
开发者ID:wushian,项目名称:MLEA,代码行数:28,代码来源:SvmLightLibDemo.cs

示例6: ParseUserId

 private string ParseUserId()
 {
     Match match = new Regex(@"user/(?<userId>\d+)/state/com.google/broadcast").Match(FeedId);
     if (!match.Success)
         return null;
     return match.Result("${userId}");
 }
开发者ID:aragorn55,项目名称:codeclimber,代码行数:7,代码来源:CountInfo.cs


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