Skip to content

[Feature] Regex to Builder codegen #82

Open
@mdjastrzebski

Description

@mdjastrzebski

Is your feature request related to a problem? Please describe.
Create a generator that would take JS regex literal as an input and output a valid TS Regex Builder DSL as an output.

Describe the solution you'd like
This could be initially used in our documentation page for users to copy-paste their JS regexes and get TS Regex Builder version. Later on that could also be used in a codemod that could be run over user source file(s).

The actual regex parsing can be done using RegExp Tree library. The remaining parts would be transforming RegExp Tree into TS Regex Builder DSL.

Describe alternatives you've considered
TS Regex Builder supports gradual migration with splitting complex regex literal into smaller literals and embedding them in the DSL, however that is a manual proces, that can be tedious with really complex expressions.

Checklist

  • Implementation
  • Tests
  • Docs: page for executing the translation
  • README docs

Additional context
There is a website for Swift Regex Builder that performs the similar function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions