linksplatform / linksplatform/RegularExpressions.Transformer.CSharpToCpp

Python regular expression counts inner groups differently

Open
#28 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.