firasdib / Regex101

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

Recognize `r'^\w+\S+[@:]\S+'` akin to `/^\w+\S+[@:]\S+/` #2158

Closed stdedos closed 7 months ago

stdedos commented 9 months ago

Feature

Pasting r['"]^\w+\S+[@:]\S+['"] should recognize it similarly to pasting /^\w+\S+[@:]\S+/.

Flags parsing might be more complicated (e.g. , re.UNICODE), but it can be ignored hopefully?

working-name commented 9 months ago

Hi @stdedos

Just FYI, if you paste it without the r, with the python flavor selected, it parses the regex correctly.

InSyncWithFoo commented 9 months ago

@working-name's correct. It will also accept trailing flags: "fo[ob]+ar"gmu. Invalid flags are ignored instead of falling back to verbatim pasting, however.

stdedos commented 9 months ago

I was hoping that r['"]^\w+\S+[@:]\S+['"] would be "uniquely" identified as:

  1. Regex
  2. Python regex

and DWIM automatically. But since there's already support - and if you are not planning to expand it, I'm fine closing this as won't-do 🙃

firasdib commented 7 months ago

Currently it just pastes the regex into the input box, no additional magic. Multiple languages share a common string format, so it would be non-trivial to switch automagically in any meaningful way.