Skip to main content
*******
triegex
*******
.. image:: https://travis-ci.org/ZhukovAlexander/triegex.svg?branch=master
:target: https://travis-ci.org/ZhukovAlexander/triegex
About
######


**triegex** is a library that builds a compact trie-structured regular expressions from a list of words.

Installation
########

.. code-block:: bash

pip install triegex

Example usage
########

.. code-block:: python

>>> import triegex
>>>
>>> t = triegex.Triegex('foo', 'bar', 'baz')
>>>
>>> t.to_regex() # build regular expression
'(?:ba(?:r\\b|z\\b)|foo\\b|~^(?#match nothing))'
>>>
>>> t.add('spam')
>>>
>>> 'spam' in t # you check if the word is in there
True
>>>
>>> import re
>>> re.findall(t.to_regex(), 'spam & eggs') # ['spam']
['spam']

Why?
####
The library was inspired by a need to match a list of valid IANA top-level domain names (`which is pretty big <http://data.iana.org/TLD/tlds-alpha-by-domain.txt>`_).

Also it's fun

**triegex** was influenced by these projects: `frak <https://github.com/noprompt/frak>`_, `regex-trie <https://github.com/alexeld/regex-trie>`_ and `Regexp-Trie <http://search.cpan.org/~dankogai/Regexp-Trie-0.02/lib/Regexp/Trie.pm>`_

Metadata

Release files for triegex 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for triegex 0.0.3
File Size Uploaded Provenance Actions
triegex-0.0.3.tar.gz 5.0 kB Without provenance Details for triegex-0.0.3.tar.gz

Release files / triegex-0.0.3.tar.gz

Download URL triegex-0.0.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fc4a9180a0b4da1319ad770a6699ff2c2bfb795532ebb95b8f72dfe75ab33410
BLAKE2b-256 checksum
How to use checksums
1d2da119369e86074d0fef12b788fb8a40683072784bec17e0e79c21e6614b3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for triegex 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page