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.

貢獻者指南