Skip to main content

Regular Expressions for Sequences of Things

Project description

Welcome to RegEx4Seq

CI Documentation Status

This is a python library that implements regular-expression based pattern matches for sequences of arbitrary objects. For example you can write pattern to determine if a list is a sequence of alternating 1's and 0's like this:

from regex4seq import Item, Items

# The core is a repetition of alternating 0s and 1s. But we need to
# account for the pattern starting on a 1 or finishing on a zero.
# Analogous to the regex /1?[01]*0?/.
pattern = Item(1).optional() & Items(0, 1).repeat() & Item(0).optional()

pattern.matches( [1, 0, 1, 0, 1, 0, 1])
# True

pattern.matches( [1, 0, 1, 0, 1, 0, 0])
# False

To learn more about the library, go to the documentation page on ReadTheDocs.

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

regex4seq-2.0.1.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regex4seq-2.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file regex4seq-2.0.1.tar.gz.

File metadata

  • Download URL: regex4seq-2.0.1.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for regex4seq-2.0.1.tar.gz
Algorithm Hash digest
SHA256 13dcba7c7386882474b2f1bb5a19ade2269d5635b8604ddeb7bddc567e011c76
MD5 2baa1428dc2b1eeb0bbb271b982d264b
BLAKE2b-256 b43efcd7e6de1dde70704e0fe9969b421c0f9bd3a90016b376128deb947b3e19

See more details on using hashes here.

File details

Details for the file regex4seq-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: regex4seq-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for regex4seq-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44381a0aec17c306525d7ee4ce085923b106528d6b7bc2d66a45cf9485982194
MD5 3da30146084de80644f4b5ffa69ccdc3
BLAKE2b-256 3edc80772345d63176fdb692e7b4a841fa03b5910e8895be1b48064a31d5db6f

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