Currently .NET uses their own nonstandard capturing group naming convention which is a dog. I would like to enable the standard use of $1, $2 capture groups in C#.
Is their any way of doing it, or if not, is their any thirdparty regexp engines available for use, which do implement that kind of functionality.
It's not 100% clear what you're looking for but it sounds like you want the ability to get the value for a given group in a matched regular expression. This is definitely possible in C# (and .Net in general).
For example.
var regex = new Regex(@"(a+)(\d+)");
var match = regex.Match("a42");
Console.WriteLine(match.Groups[1].Value); // Prints a
Console.WriteLine(match.Groups[2].Value); // Prints 42
While I don't use Mono regularly, I would be very surprised if this didn't work there as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With