// class Program { }
// class Program { };
(new Regex(@"(struct|class) ([a-zA-Z0-9]+[^\r\n]*)([\r\n]+(?<indentLevel>[\t ]*)?)\{([\S\s]+?[\r\n]+\k<indentLevel>)\}([^;]|$)"), "$1 $2$3{$4};$5", Null, 0),
# class Program { }
# class Program { };
(r"(struct|class) ([a-zA-Z0-9]+[^\r\n]*)([\r\n]+(?P<indentLevel>[\t ]*)?)\{([\S\s]+?[\r\n]+(?P=indentLevel))\}([^;]|$)", r"\1 \2\3{\5};\6", None, 0),
Compare: "$1 $2$3{$4};$5" and r"\1 \2\3{\5};\6".
To be able to write expression that can be easily translated from C# to Python we should use group names not numbers.
Compare:
"$1 $2$3{$4};$5"
andr"\1 \2\3{\5};\6"
.To be able to write expression that can be easily translated from C# to Python we should use group names not numbers.