dotnet/runtime

Regex - Support Possessive Quantifiers

开放

#24,381 创建于 2017年12月7日

 (9 条评论) (5 个反应) (0 位负责人)C# (5,445 个派生)batch import
area-System.Text.RegularExpressionsenhancementhelp wanted

仓库指标

星标
 (17,886 个星标)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

Current popular regex engines like java.util.regex or PCRE support greedy, lazy and possessive quantifiers. The current .NET regex engine does only support the former two. Though possessive quantifiers are syntactic sugar and can be mimicked with atomic grouping today, consider supporting them as they gained popularity over the last years.

Abstract: Possessive quantifiers work the same as greedy quantifiers but without backtracking on the input string. That means that the following pattern D++[A-Z]+ matches the input string DDDDE but not DDDD.

贡献者指南