firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.26k stars 199 forks source link

Translate existing regex to new flavor specs upon switch #1629

Open rosyth opened 3 years ago

rosyth commented 3 years ago

Feature

For instance, I can write in Perl m/[^[:ascii:]]+/ to find any strings which have non-ascii characters. But now I want to use the same construct in Python (without having to think too much), but Python (for reasons I can't fathom) chooses not to allow these constructs. It would be nice to be able to have a button to translate a regex into language XYZ from another that we may be more familiar with. Another place I often get caught out is working in Perl and then switching to VIM.

angusryer commented 3 years ago

This would be an amazing feature. Just tried to convert PCRE2 to ECMA.

firasdib commented 2 years ago

I don't think this will be possible beyond rudimentary differences, such as (?P<name>...) being converted to (?<name>...). How should things where there is no support be handled?

Emasoft commented 2 years ago

I strongly agree with this feature request. Automatic Flavor Conversion is an essential feature IMHO. Most of the times we found a RegEx in the library that does what we want, but it is in the wrong flavor. 90% of the times it's in the wrong one. Especially the substitution string. We spend too much time rewriting it, and often we just search other regex websites looking for a ready one in the flavor we need.