serp-re
A re drop-in with true backtracking semantics, written in the Serpentine
subset. Patterns compile to a small instruction program run by a recursive
backtracking VM: alternation is first-alternative-wins, quantifiers are
greedy/lazy with full backtracking into repeated bodies, and capture groups
record the last iteration — CPython semantics, verified by 30,000+
differential checks against the real re module (including a 3k random
pattern fuzz).
API
compile(pattern, flags=0) -> Pattern, match, fullmatch, search
(returning Match | None), findall, finditer (eager list[Match]),
sub, split, escape, the error exception (CPython 3.11 messages), and
flags IGNORECASE/I, MULTILINE/M, DOTALL/S (combine with + — the
subset has no | on ints). Match supports group(n)/groups()/start/end/ span/string and prints as <re.Match object; span=(0, 3), match='abc'>.
Supported syntax
Literals, ., escapes (\d \D \w \W \s \S \b \B \A \Z, punctuation,
\n \t \r \f \v), classes [abc] / [a-z] / [^...], quantifiers
* + ? {m} {m,} {,n} {m,n} plus lazy variants, groups (...), (?:...),
(?P<name>...) (positional access), alternation |, anchors ^ $.
Caps (loud errors or documented divergences)
- No backreferences or lookarounds (raise
error). \w/\sclassification is ASCII.findallwith 2+ capture groups raises (usefinditer).groups()returns a PyVal list, not a tuple;split()fills unmatched group parts with''instead ofNone.subreplacement is a string template (\1,\g<n>, escapes) — no callables.finditeris eager.{m,n}capped at 1000.- The engine recurses while backtracking; very long quantified matches can exhaust the stack.
Install
serp add serp-re
pip install serp-re
Metadata
Release files for serp-re 0.2.1
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 | Actions |
|---|---|---|---|---|
| serp_re-0.2.1.tar.gz | 10.2 kB | With provenance | Details for serp_re-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serp_re-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for serp_re-0.2.1-py3-none-any.whl |
Total release size: 19.4 kB
Release files / serp_re-0.2.1.tar.gz
| Download URL | serp_re-0.2.1.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6f0ca10b53a01bbd0e7bd9d89459256d28de310b81c49eba5d05e21d98d2599
|
|
BLAKE2b-256 checksum How to use checksums |
4e45284368ed60e12aa0f38d813c8459b4972a0c3441b6b4dfaf16567dbf1189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 27, 2026.
Transparency logRelease files / serp_re-0.2.1-py3-none-any.whl
| Download URL | serp_re-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d46af4a3038948d2f0f3c4e4e77af99deedfe81eaa5b35cc69ef5ccb4f7fde0
|
|
BLAKE2b-256 checksum How to use checksums |
d3c50a70ee0f9d3ef8d86a83d175c14c12b2596ec8abdef8a0edb312fb233ea4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 27, 2026.
Transparency logSecurity for serp-re 0.2.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for serp_re-0.2.1.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 27, 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.