Pycregex, C-style POSIX BRE (and ERE) syntax regex for Python
This package brings libc's <regex.h> API to Python. While Python has re and there's the regex package, they do not have the syntax of <regex.h>. The simplest example is the regex pattern f\(oo\) which is not supported by either of the mentioned packages, because neither supports escaping the parentheses. The syntax of <regex.h> is specified in POSIX, see the Base Specification v8 Regular Expressions chapter.
This is not a glorious API, but if you need it, here it is.
Example
We search with subgroups, and show how the subgroup begin/end indices are accessed.
import pycregex
# Note that this package only works with binary strings. nmatch is
# number of groups plus one because we must include the entire match.
p = pycregex.compile(b"f\\(oo\\)", nmatch=2)
p.search(b"foo") # ==> 0
p.span() # ==> [(0, 3), (1, 3)]
Metadata
Release files for pycregex 2.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycregex-2.0.4.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycregex-2.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.6 kB
Release files / pycregex-2.0.4.tar.gz
| Download URL | pycregex-2.0.4.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afe2b1f07499b6f2258024d8b32d627e93e7b29be28ae79d8471aade104fc126
|
|
BLAKE2b-256 checksum How to use checksums |
fea6a41b7a8605b5891aff4b5778cd26d400b5c1363e4f373d9faa2eb78ab53a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / pycregex-2.0.4-py3-none-any.whl
| Download URL | pycregex-2.0.4-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4cfda5224ea26a92cc8c5646ce185ed0e1b2e235e8545ea1759531bef916d5e
|
|
BLAKE2b-256 checksum How to use checksums |
705b2b7c6bf342b4e2d0f105ee3d5b31fa2e8953c21997a2aacfd7f40a5813b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|