dotnet/runtime

Regex - Support Possessive Quantifiers

Open

#24,381 建立於 2017年12月7日

在 GitHub 查看
 (9 留言) (5 反應) (0 負責人)C# (5,445 fork)batch import
area-System.Text.RegularExpressionsenhancementhelp wanted

倉庫指標

Star
 (17,886 star)
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.

貢獻者指南