I have a .NET Regex which looks similar to:

(?<Type1>AAA)|(?<Type2>BBB)

I'm using the Matches method against a sample string e.g. "AAABBBAAA", and then iterating over the matches.

My goal is to find the match types, using the regex match group, so for this regex it will be:

  • Type1
  • Type2
  • Type1

I couldn't find any GetGroupName method. Please help.

Edit
Report