Skip to content

Incorrect Regex matching result in compiled mode #52612

@veanes

Description

@veanes

Reproduce in .NET5.0.
The code below will print the following where False is an error:
False
True

string input = "this string has .digest as a substring";
Regex reC = new(@"[^a-z0-9]etag|[^a-z0-9]digest", RegexOptions.Compiled);
Regex re = new(@"[^a-z0-9]etag|[^a-z0-9]digest");
Console.WriteLine(reC.IsMatch(input));
Console.WriteLine(re.IsMatch(input));

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions