A bit more specific pattern could be:
(\S )[\p{Zs}\t] \(([0-9] )\)
(\S )Capture group 1, match 1 non whitespace chars[\p{Zs}\t]Match 1 or more spaces (\scan also match a newline)\(([0-9] )\)Capture group 2, match 1 digits 0-9 between matchint the(and)
CodePudding user response:
You did it correctly. According to .NET documentation:
the first element of the GroupCollection object (the element at index 0) returned by the Groups property contains a string that matches the entire regular expression pattern
So, regex pattern with 2 groups will return 3 results:
- string that matches the pattern
- 1st group
- 2nd group

