Skip to main content

An implementation of the GNU interface to regex in Python

Reason this release was yanked:

crashed in Python 3.10 and earlier due to ctypes bug

Project description

Pygnuregex, GNU regex for Python

Pygnuregex is a Python package for the GNU interface of regex functions in <regex.h>. The GNU interface provides a wide range of different syntaxes for the regex compiler. This package requires GNU libc to work properly; prefer the sdist if you're worried about ABI compatibility.

Example

import pygnuregex

# Search for the first match
p = pygnuregex.compile(b"f\\(oo\\)[0-9]+")
result = p.search(b"hello foo123!") # ==> 6
p.span() # ==> [(6, 12), (7, 9)]

# All matches
p = pygnuregex.compile(b"\\(foo\\|bar\\)[0-9]+")
list(p.finditer(b"hello foo123 and bar456!"))
# ==> [[(6, 12), (6, 9)],[(17, 23), (17, 20)]]

The SyntaxFlag enum contains all the available syntax options that may be set in pygnuregex.compile().

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygnuregex-1.1.4.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file pygnuregex-1.1.4.tar.gz.

File metadata

  • Download URL: pygnuregex-1.1.4.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for pygnuregex-1.1.4.tar.gz
Algorithm Hash digest
SHA256 b721826de7a8f04908415a418ebaf609b23c826eb1af47550e4c8f395b7d6d66
MD5 3bb890dc828eb6b24155d4682d1bada0
BLAKE2b-256 5b8ce57e4494c7314ffc5530a6a70629b4fbdcdfc42fd361daf4ad9efc4cb39a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page