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 TrieFastRegex 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.2.0.tar.gz (3.5 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.2.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file triefastregex-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for triefastregex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6ffb61aea96954905ad94da4062033158124016e27f208e3422e2e4eba6f1730
MD5 575febfc447e551844599454f223474f
BLAKE2b-256 ae8827b972718fcbf19d1062db212f4ecb752a9e5fcb44eb655fde4559b62a44

See more details on using hashes here.

File details

Details for the file triefastregex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: triefastregex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for triefastregex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d7179e3f83fc6bfecf335a9f9c565a9cbbc7dc3c0029260fe81f21d49c4a66c
MD5 f6d83538e6a7302113672c18704a2038
BLAKE2b-256 de6b8e945251cddb1897fd2b063660b57b638631070df48b15d39435c85de509

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