firasdib / Regex101

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

Python 'regex' module support #1405

Open OnlineCop opened 3 years ago

OnlineCop commented 3 years ago

This may be a duplicate of #1219.

I see multiple issues being opened regarding Python syntax: #1271, #1403, #1404.

Should we offer users who choose Python as the flavor, a choice to select either the re or the regex modules?

regex is backward-compatible with re but extends many of the PCRE features, like inline flags, \K, recursion, etc.

firasdib commented 3 years ago

Wouldn't their need be filled by simply using the PCRE flavor?

OnlineCop commented 3 years ago

Mostly, yes, but if PCRE were selected as the flavor, the Code Generator is using the re module instead of the regex module when you change to the Python language.

Most of those advanced features are supported under the regex module, so we might want to change re for regex when the Flavor is PCRE and the Code Generator language is set to Python.

Doqnach commented 3 years ago

Possible alternative is to have multiple code generators for Python? (2 vs 3, re vs regex)

genericusername3 commented 2 years ago

Wouldn't their need be filled by simply using the PCRE flavor?

No, actually. In contrast to PCRE, the regex module supports variable-width lookbehinds, for instance (like ECMAScript, but the named group structure in ECMA is (?<name>pattern) instead of (?P<name>pattern))