Skip to main content

regex2dfa

Convert regular expressions to minimized DFAs in AT&T FST format.

Pure Python · Zero dependencies · Results cached in memory

Installation

pip install regex2dfa

Usage

from regex2dfa import regex2dfa

dfa = regex2dfa("(a|b)+")
print(dfa)

Output:

0	1	97	97
0	1	98	98
1	1	97	97
1	1	98	98
1

Features

  • Pure Python — No external dependencies
  • Fast — Results cached with LRU (1024 entries)
  • Complete pipeline — Thompson's → Subset → Hopcroft minimization

Supported Syntax

Feature Syntax Example
Literal a abc
Any char . a.b
Character class [abc], [a-z], [^abc] [0-9]+
Quantifiers *, +, ? a*, b+, c?
Alternation | cat|dog
Grouping (...) (ab)+
Escapes \x00, \d, \w, \s, \C \xFF, \d+

Output Format

AT&T FST format with tab-separated fields:

  • Transitions: src dst input output
  • Final states: state_id

Labels are ASCII byte values (e.g., 97 = 'a').

Links

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regex2dfa-0.2.2.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

regex2dfa-0.2.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file regex2dfa-0.2.2.tar.gz.

File metadata

  • Download URL: regex2dfa-0.2.2.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for regex2dfa-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0b15adbce32667d9edb030bb93c7fa03331e7a33602b4b3ec8a1a5e006800369
MD5 58a33286ace891ee766bb336b0808154
BLAKE2b-256 9d9788bda8c546181d5731e58562a058a74f078b0018b1d23109d545da2f5853

See more details on using hashes here.

Provenance

The following attestation bundles were made for regex2dfa-0.2.2.tar.gz:

Publisher: publish.yml on kpdyer/regex2dfa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file regex2dfa-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: regex2dfa-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for regex2dfa-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e09bc167c1b60c4f0314e8b9db5d1e3c65ec01f3f6e44b6a5ea912efb13b1d86
MD5 99bb87440eb611f0ffe16773812bbf80
BLAKE2b-256 575e2de421400ffe4a345505828c287615e31a0aeeaf1d8c83d48a89c3e45ce9

See more details on using hashes here.

Provenance

The following attestation bundles were made for regex2dfa-0.2.2-py3-none-any.whl:

Publisher: publish.yml on kpdyer/regex2dfa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 files

0.2.1

2 files

0.1.9

1 file

0.1.8.post2

1 file

0.1.7.post7

1 file

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