You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// class Program { }// class Program { };(newRegex(@"(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.
The text was updated successfully, but these errors were encountered:
Konard
changed the title
Python regular expression count groups differently
Python regular expression counts groups differently
Mar 26, 2020
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.
The text was updated successfully, but these errors were encountered: