Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New regex flavor targeting Python's regex module #87

Open
Aloso opened this issue Mar 28, 2023 · 0 comments
Open

New regex flavor targeting Python's regex module #87

Aloso opened this issue Mar 28, 2023 · 0 comments
Labels
C-flavors Issues about adding or modifying flavors C-language Issues regarding Pomsky's syntax enhancement New feature or request

Comments

@Aloso
Copy link
Member

Aloso commented Mar 28, 2023

Is your feature request related to a problem? Please describe.

The re module, which is part of Python's standard library, has shockingly poor Unicode support.

The biggest issue is that \w and \b don't conform to the Unicode spec, so we can't support them with Unicode enabled. This means that Pomsky is much less useful when targeting Python.

The other problem is that people who use the much better regex module, can't profit from its good Unicode support when using Pomsky.

Describe the solution you'd like

The Python flavor is split in two:

  • PythonRe, the old library from the standard library with poor Unicode support
  • PythonRegex, the better third-party library with good Unicode support

In the CLI, -f python should alias to python-re, but issue a warning.

In the PythonRegex flavor, many other things also work that aren't supported in PythonRe:

  • Unicode properties
  • Grapheme matcher
  • Atomic groups
  • Character set intersection and subtraction

Describe alternatives you've considered

Add a nonstandard_unicode mode, so \w can be used in flavors where \w matches some non-ASCII word characters, but not all (i.e. Python and .NET). This solves the first problem, but not the second.

@Aloso Aloso added enhancement New feature or request C-language Issues regarding Pomsky's syntax labels Mar 28, 2023
@Aloso Aloso added the C-flavors Issues about adding or modifying flavors label Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-flavors Issues about adding or modifying flavors C-language Issues regarding Pomsky's syntax enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant