pomsky-lang / pomsky

A new, portable, regular expression language
https://pomsky-lang.org
Apache License 2.0
1.28k stars 19 forks source link

New regex flavor targeting Python's `regex` module #87

Open Aloso opened 1 year ago

Aloso commented 1 year ago

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:

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:

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.