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


C# Regex.Any方法代码示例

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


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

示例1: IsApplicable

 private static bool IsApplicable(Regex[] filters, string name)
 {
     return filters.Length == 0 || !filters.Any(filter => filter.IsMatch(name));
 }
开发者ID:KGuetter,项目名称:msbuildtasks,代码行数:4,代码来源:DependencyGraph.cs

示例2: GetAllPagesUnderWithDocument

        /// <summary>
        /// Get every WebPage.Internal on a web site (or part of a web site) visiting all internal links just once
        /// plus every external page (or other Url) linked to the web site as a WebPage.External
        /// </summary>
        /// <remarks>
        /// Use .OfType WebPage.Internal to get just the internal ones if that's what you want
        /// </remarks>
        public static IEnumerable<WebPageWithDocument> GetAllPagesUnderWithDocument(Uri urlRoot, int delayBetweenPagesInSeconds, Regex[] excludedPaths)
        {
            // Get the root page ...

            HttpWebResponse webResponse = FetchWebPageWithRetries(urlRoot);

            if (webResponse.ResponseUri.AbsoluteUri != urlRoot.AbsoluteUri)
            {
                Console.WriteLine("*** ROOT REQUEST WAS REDIRECTED USING: " + webResponse.ResponseUri + "***");
                urlRoot = webResponse.ResponseUri;
            }

            var queue = new QueueWithDeduping<PendingCrawlItem>();

            var start = PendingCrawlItem.Factory(urlRoot:urlRoot, href:urlRoot, referrer:urlRoot);
            queue.Enqueue(start);

            while (queue.Count > 0)
            {
                // pull an item off the queue, inspect it and deal with it
                var nextItem = queue.Dequeue();

                if (excludedPaths.Any(p => p.IsMatch(nextItem.Uri.AbsoluteUri)))
                {
                    Console.WriteLine("Skipping " + nextItem.Uri + " because path is excluded");
                    continue;
                }

                var result = ProcessNextItem(nextItem, queue);
                yield return result;
                // And delay but only on internal pages - external pages don't count
                if (!(result.WebPage is WebPage.External))
                    Thread.Sleep(delayBetweenPagesInSeconds);
            }
        }
开发者ID:tsunli,项目名称:LinkChecker,代码行数:42,代码来源:Spider.cs


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