ts-regex-builder icon indicating copy to clipboard operation
ts-regex-builder copied to clipboard

[Feature] Regex to Builder codegen

Open mdjastrzebski opened this issue 3 months ago • 0 comments

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.

mdjastrzebski avatar Apr 14 '24 17:04 mdjastrzebski