Crates.io | pomsky-syntax |
lib.rs | pomsky-syntax |
version | 0.11.0 |
source | src |
created_at | 2022-09-10 17:37:44.270996 |
updated_at | 2023-11-09 09:35:11.721155 |
description | Parser for pomsky, a new regular expression language |
homepage | https://pomsky-lang.org |
repository | https://github.com/pomsky-lang/pomsky |
max_upload_size | |
id | 662624 |
size | 230,074 |
To begin, check out the website.
Read the blog or the changelog to learn about new features.
Pre-built binaries can be found on the releases page.
Pomsky can also be installed from source via cargo with cargo install pomsky-bin
.
Pomsky is currently compatible with PCRE, JavaScript, Java, .NET, Python, Ruby and Rust. The regex flavor must be specified during compilation, so Pomsky can ensure that the produced regex works as desired on the targeted regex engine.
Note: You should enable Unicode support in your regex engine, if it isn't enabled by default. This is explained here.
Pomsky aims to be as portable as possible, polyfilling Unicode and unsupported features where feasible. That said, there are some cases where portability is not possible:
Some features (e.g. lookaround, backreferences, Unicode properties) aren't supported in every flavor. Pomsky fails to compile when you're using an unsupported feature.
\b
(word boundaries) are not Unicode aware in JavaScript. Pomsky therefore only allows word boundaries when Unicode is disabled.
\w
in .NET handles Unicode incorrectly, with no way to polyfill it properly. This means that in .NET, [word]
only matches the L
, Mn
, Nd
, and Pc
general categories, instead of Alphabetic
, M
, Nd
, Pc
and Join_Control
.
In .NET, .
, Codepoint
and character classes (e.g. [Latin]
) only match a single UTF-16 code unit rather than a codepoint.
[space]
matches slightly different code points in JavaScript than in Java. This will be fixed.
Backreferences behave differently in JavaScript and Python when the referenced group has no captured text. There is nothing we can do about it, but we could add a warning for this in the future.
Never compile or execute an untrusted Pomsky expression on your critical infrastructure. This may make you vulnerable for denial of service attacks, like the Billion Laughs attack.
Pomsky looks for mistakes and displays helpful diagnostics:
I wrote an in-depth comparison with similar projects, which you can find here.
The Code of Conduct can be found here.
You can contribute by using Pomsky and providing feedback. If you find a bug or have a question, please create an issue.
I also gladly accept code contributions. More information
Dual-licensed under the MIT license or the Apache 2.0 license.