linksplatform / linksplatform/RegularExpressions.Transformer.CSharpToCpp
Python regular expression counts inner groups differently
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
```C#
// class Program { }
// class Program { };
(new Regex(@"(struct|class) ([a-zA-Z0-9]+[^\r\n]*)([\r\n]+(?[\t ]*)?)\{([\S\s]+?[\r\n]+\k)\}([^;]|$)"), "$1 $2$3{$4};$5", Null, 0),
```
```Python
# class Program { }
# class Program { };
(r"(struct|class) ([a-zA-Z0-9]+[^\r\n]*)([\r\n]+(?P[\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](https://github.com/linksplatform/RegularExpressions.Transformer.CSharpToPython) we should use group names not numbers.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the C# and Python regular-expression examples in the issue, then locate the transformation entry point that produces replacement references. Done means translated Python expressions use named groups rather than numeric references while preserving the shown replacement behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100