corvus-regex-ecma262 for Python
Regular expressions with the grammar and the answers of ECMA-262, the RegExp of JavaScript, for Python: the
corvus-regex-ecma262 Rust crate, as a typed package with
wheels for Linux (glibc and musl), macOS and Windows, x64 and arm64, for every Python from 3.10.
- Every flag:
d,g,i,m,s,u,vandy, with the grammar of each. Withoutuorva pattern is read by the Annex B grammar and matched by UTF-16 code unit, as ECMA-262 matches it; with them, by code point. Thevflag has nested classes, the difference and the intersection of classes, strings in a class and the properties of strings. - ECMAScript 2025: lookbehind, named groups (and a name shared between alternatives), modifier groups such as
(?i:...), and every Unicode property ECMA-262 lists, from Unicode 17 tables the crate carries. strandbytes(UTF-8). A pattern answers as it does in a browser or Node, which Python'sredoes not:\d,\w,\b,.and$, case folding,\p{...}and the rest read as JavaScript reads them.- Every match runs without the GIL. A pattern without a backreference is matched in time proportional to its size times
the text, and
testandsearchtake a timeout, so neither a pattern nor a text from outside can make a program hang.
Compliance. Over the ECMA-262 test data (what V8 says
about 109,547 patterns and 5,325,026 texts, exec, the global search, replace and split among them), through this
package over str and over bytes, it gives 23,625,595 right answers and none wrong, refuses no valid pattern,
accepts no invalid one and reaches no limit. CI runs the whole data on Linux and Windows on every change. (The data
asks 21,482 more questions, each a search that starts between the two halves of a character beyond the Basic
Multilingual Plane, which a str position cannot name; the crate answers them all over UTF-16.)
Install
pip install corvus-regex-ecma262
Getting started
import corvus_regex_ecma262 as ecma
# The flags are those of new RegExp(pattern, flags).
date = ecma.compile(r"(?<year>\d{4})-(?<month>\d{2})", "gu")
date.test("due 2026-10") # True
m = date.search("due 2026-10")
m["year"], m.span(), m.groupdict() # '2026', (4, 11), {'year': '2026', 'month': '10'}
# Every match of a global search, as matchAll makes it.
[m.group() for m in date.finditer("2026-10, 2027-01")] # ['2026-10', '2027-01']
# replace replaces every match with the g flag, and the first without it; a function may give each replacement.
date.replace("2026-10, 2027-01", "$<month>/$1") # '10/2026, 01/2027'
date.replace("2026-10", lambda m: m["month"]) # '10'
# split splices in what the groups captured; a group that did not take part is None.
ecma.compile(r"\s*(;)\s*").split("a ; b;c") # ['a', ';', 'b', ';', 'c']
The API
compile(pattern, flags=""), Regex(pattern, flags="") |
Compiles a pattern as new RegExp(pattern, flags) does; raises error when it is not valid. |
is_valid(pattern, flags="") |
Whether a pattern is valid, without compiling it. |
Regex.test(string, pos=0, *, timeout=None) |
RegExp.prototype.test with lastIndex at pos (at pos alone with y). |
Regex.search(string, pos=0, *, timeout=None) |
The first match at or after pos, as exec finds it: a Match, or None. |
Regex.finditer(string) |
A global search as matchAll makes it: an iterator of Match. |
Regex.replace(string, replacement) |
String.prototype.replace: the first match, or every match with g; the replacement is a template or a function of the Match. |
Regex.replace_all(string, replacement) |
String.prototype.replaceAll: every match. |
Regex.split(string, limit=None) |
String.prototype.split: a list of strings, None for a group that did not take part. |
Regex.pattern, .flags, .groups, .group_names |
What the pattern is. |
A Match is read as an re.Match is: group(*groups), m[g], groups(default), groupdict(default), start(g),
end(g), span(g) (a group that did not take part is None, at -1), string and re; a group is a number or a name.
Positions. Over a str positions are code points, as Python indexes it; over bytes they are bytes of UTF-8.
Without u or v a pattern is matched by UTF-16 code unit, so a match can take half of a character beyond the Basic
Multilingual Plane, as in JavaScript: over a str its text holds that half as a lone surrogate, as a JavaScript
string would, and its start and end are the whole character's; over bytes the position between the halves is the
character's third byte. A str may hold lone surrogates; a lone surrogate written into a pattern is read as U+FFFD
(write it as the escape \ud800 to match one).
Errors. error (a ValueError) says why a pattern did not compile in its message and in kind: "pattern",
"flags" or "too_large". A match that reaches its timeout, or its cap on backtracking memory, raises
MatchLimitError, a kind of error.
Threads. A Regex is immutable and may be used from any number of threads; matching releases the GIL.
Benchmarks
The Industry workloads of dotnet/performance, this package against Python's re, the regex package and V8, are on
the central page, corvus-oss.org/corvus-regex-ecma262-benchmarks,
measured nightly on one runner with every other Corvus ECMA-262 engine.
Repository
src/lib.rs: the binding (PyO3, abi3);python/corvus_regex_ecma262: the package and its type stubs.tests/: the tests;tools/dataset.py: the test-data runner (python tools/dataset.py <data> wrong.tsv).tools/bench: the benchmark harness and the script the image runs;Dockerfile: the image the central page runs.
Licence
Apache-2.0. See LICENSE.
Metadata
Release files for corvus-regex-ecma262 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| corvus_regex_ecma262-0.1.2.tar.gz | 45.9 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| corvus_regex_ecma262-0.1.2-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| corvus_regex_ecma262-0.1.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 | Details |
Total release size: 5.8 MB
Release files / corvus_regex_ecma262-0.1.2.tar.gz
| Download URL | corvus_regex_ecma262-0.1.2.tar.gz |
|---|---|
| Size | 45.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c8e27f317fc0b7e33f4d4df411ad65b20515620bd6f11faf4e6e84d5722094f
|
|
BLAKE2b-256 checksum How to use checksums |
18d93a8adb40b4f4ee98ccd2de01bd87c316db4f05368ca1a24938b96faf9cd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-win_arm64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 546.4 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b084fdf3cebc2b47067308c21ca87dcb22616edabae8b23f63a58f8b7cb0c74e
|
|
BLAKE2b-256 checksum How to use checksums |
f67b13be97d31810e21d0c51d320612a696e3696cbc43b82a3e856f45578c26f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 624.7 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f501c15e16978c8bc540d89ae02888cf0b99466e336a9515e9dcf1cf81709242
|
|
BLAKE2b-256 checksum How to use checksums |
ed4c7d928b5eff9e9c1214dfdec289ffbdd9333563faaa6afdf661eacac1355d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 958.5 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
46370c3973b702727cb31a422527187f09ef4c73cbcbd7780258ce683f2beb6c
|
|
BLAKE2b-256 checksum How to use checksums |
575a34fc68cdf1d0d84d8fb1e50648980ae404dfa97379c14334dd47b8d11006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 859.6 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0d5062694ca00cf281b84152a0f1a360d2b214d0de99d103ceaf7fbb0f93e7a8
|
|
BLAKE2b-256 checksum How to use checksums |
94f6286b5ccd8fda23b5e0f3cbbda5194d287513bf93cbb12466d49eb76eb8c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 744.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
645c65a9047757b6a4c0b8eaff1a476e71635d26a5b05f7762854b753f58c68f
|
|
BLAKE2b-256 checksum How to use checksums |
6ed28a693cfb4b10901ccda0a26a9224824e1c6296bf2322938a55d8fff7a847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 682.2 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c7cb090ee96c1825effd51c3ae8ef97c278ad4e28ac89f9ad2e4c9dbdf0715ca
|
|
BLAKE2b-256 checksum How to use checksums |
040bc890e265f74bc1d6ade71cd64b21275fd64da5a7bd8818b03a6a5d56fb3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logRelease files / corvus_regex_ecma262-0.1.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | corvus_regex_ecma262-0.1.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2ad7afd823aba417c147421e7383ac201e81e4b07b58b2d73b3cea9007c78eb7
|
|
BLAKE2b-256 checksum How to use checksums |
76980bf9dcbb9475094d6cf82c43e8838d96932545ed6327d418ae8f01da0839
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logSecurity for corvus-regex-ecma262 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for corvus_regex_ecma262-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.