Metadata-Version: 2.4
Name: regex4seq
Version: 2.0.0
Summary: Regular Expressions for Sequences of Things
Project-URL: Homepage, https://regex4seq.readthedocs.io/en/latest/
Project-URL: Documentation, https://regex4seq.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/sfkleach/regex4seq
Author-email: Stephen Leach <sfkleach@gmail.com>
License: LGPL-3.0-or-later
License-File: LICENSE
Keywords: pattern matching,regex,regular expressions,sequence matching
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# Welcome to RegEx4Seq

[![CI](https://github.com/sfkleach/regex4seq/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sfkleach/regex4seq/actions/workflows/ci.yml) [![Documentation Status](https://readthedocs.org/projects/regex4seq/badge/?version=latest)](https://regex4seq.readthedocs.io/en/latest/?badge=latest)

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:

```py
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](https://regex4seq.readthedocs.io) page on ReadTheDocs.
