Skip to main content

A compact regular expression builder from string lists using Trie data structure

Project description

TrieFastRegex

A Python library for building compact regular expressions from lists of strings using Trie data structure.

Installation

pip install TrieFastRegex

Usage

from pyTriEX import build_regex_from_list

# Build regex from a list of strings
strings = ["cat", "car", "card", "care", "careful"]
regex = build_regex_from_list(strings)
print(regex)  # ^ca(?:t|r(?:(?:d|e(?:ful)?))?)$

# Use the regex
import re
pattern = re.compile(regex)
print(pattern.match("car"))  # Match object
print(pattern.match("dog"))  # None

Features

  • Efficient Trie-based regex construction
  • Compact output patterns
  • Easy to use

License

MIT License

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

triefastregex-0.1.1a0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

triefastregex-0.1.1a0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file triefastregex-0.1.1a0.tar.gz.

File metadata

  • Download URL: triefastregex-0.1.1a0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for triefastregex-0.1.1a0.tar.gz
Algorithm Hash digest
SHA256 6c530ec4cd41cde290d33346485f8876ce609bddac60b2499bde4e2add4cf79b
MD5 6381e3adf28441f6fe6144bab6e86d9e
BLAKE2b-256 97a322d19c37958105a3b498fe94de4389cb71c12994965fc8f0023bcc94ae27

See more details on using hashes here.

File details

Details for the file triefastregex-0.1.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for triefastregex-0.1.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 cff6da8db77c69878a28dc314d98702245584e2060d232dab4e93b7eb598e68e
MD5 a280206afe40b5828d72bbae81110792
BLAKE2b-256 ea0b3368a8951f8748157f71514c865b3e2d4acccb6959139cef130467e0a6fc

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