-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.RegularExpressions
Milestone
Description
Background and motivation
The .NET regex engine today works based on an NFA/backtracking-based engine. For .NET 7, we're exploring adding an opt-in DFA-based engine. To opt-in, we'd use a new RegexOptions enum value.
API Proposal
namespace System.Text.RegularExpressions
{
public enum RegexOptions
{
...
Constrained = 0x0400
}
}Other name choices could include DFA, Deterministic, Safe, Predictable, ...
API Usage
var r = new Regex(..., RegexOptions.Constrained);Risks
It is opt-in as the engine will almost certainly have some limitations on what patterns are supported (e.g. look behinds), impact on capture semantics, etc.
vcsjones, ChristophTF, eerhardt, MihaZupan, airbreather and 1 more
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.RegularExpressions