Is there any way to define custom character class in C# regex?
In flex it is done in very obvious way:
DIGIT [0-9]
%%
{DIGIT}+ {printf( "An integer: %s (%d)\n", yytext, atoi( yytext ) );}
http://westes.github.io/flex/manual/Simple-Examples.html#Simple-Examples
As explained in this answer, in PHP defining a custom character class works like this:
(?(DEFINE)(?<a>[acegikmoqstz@#&]))\g<a>(?:.*\g<a>){2}
Is there a way to achieve this result in c#, without repeating the full character class definition each time it is used?