callstack / callstack/ts-regex-builder
[Feature] Regex to Builder codegen
- Dominant language
- TypeScript
- Stars
- 157
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
**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](https://github.com/DmitrySoshnikov/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](https://swiftregex.com/) for Swift Regex Builder that performs the similar function.
Contributor guide
Assessment
This issue has not been assessed yet.