-
Notifications
You must be signed in to change notification settings - Fork 5.3k
add capture group name in comment #63255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsFixes #62715
|
|
Can capture group names contain newline characters? That could break the code that's emitted. |
Newline characters are not valid inside group name. If you try it inside a console app, you will get a RegexParseException with message : "Invalid pattern '[regex]' Invalid group name: Group names must begin with a word character." |
...pressions/tests/System.Text.RegularExpressions.Generators.Tests/RegexGeneratorParserTests.cs
Outdated
Show resolved
Hide resolved
...pressions/tests/System.Text.RegularExpressions.Generators.Tests/RegexGeneratorParserTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
...pressions/tests/System.Text.RegularExpressions.Generators.Tests/RegexGeneratorParserTests.cs
Outdated
Show resolved
Hide resolved
That message is wrong, it should say "Invalid pattern '[regex]' Invalid group name: Group names must only contain word characters.". |
- Pass correct arguments into GroupNameFromNumber from RegexCode - Use capture group name for backreferences and backreference conditionals as well - Only render the group number if there is no name - Consistenly use the "capture group" suffix - Clean up GroupNameFromNumber to avoid duplicate string.Empty fallback cases - Fixes rendering of balancing groups
|
Thanks, @pedrobsaila. I rebased your branch and pushed a commit to fix up a few things. Should be good to go once CI passes. |
Fixes #62715