Skip to content

Regex should fail to parse "^*" #29174

@yetanotherchris

Description

@yetanotherchris

I have the following C# regular expression

var regex = new Regex(@"^*_.$");
string input = "THIS_LINE_HAS_MANY_UNDERSCORES_L";

string result = regex.Match(input).Groups[0].Value;
Console.WriteLine(result);

Even though to the best of my knowledge the regex is invalid (* has no element to match on), it outputs the following (which is really just the _.$ part):

_L

Is ^ treated as a character class by the .NET Regex engine?

Metadata

Metadata

Assignees

Labels

area-System.Text.RegularExpressionshelp wanted[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions