Skip to main content

Regular Expressions for Sequences of Things

Project description

Welcome to RegEx4Seq

CircleCI 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-1.0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: regex4seq-1.0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.5.0-10031-tuxedo

File hashes

Hashes for regex4seq-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ee2e510e46dce0ff27fcb7f6bf05e69dd65ec18d7de852f205e6c76ec931ad5a
MD5 d8c98e6a918a10d30afe5823ed76ca53
BLAKE2b-256 368e28a2367bda68f20065f873b83cd831886d1c230506f639d622367c364729

See more details on using hashes here.

File details

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

File metadata

  • Download URL: regex4seq-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.5.0-10031-tuxedo

File hashes

Hashes for regex4seq-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aae7edfd8215e3ea5825782fd9c74b01a6b48f42e578fb0d18973ba3fd7270e0
MD5 e258ce8ab2a51eb977f8755760d87c97
BLAKE2b-256 cbc5dfa6ddbce495022bcfd7c5ac731c1c00e1ab15bc1ee47e00b27908d328e6

See more details on using hashes here.

Supported by

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