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').

License

MIT

Metadata

Release files for regex2dfa 0.2.2

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

Source distribution (sdist)

Source distribution for regex2dfa 0.2.2
File Size Uploaded
regex2dfa-0.2.2.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for regex2dfa 0.2.2
File Interpreter ABI Platform
regex2dfa-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.7 kB

Release files / regex2dfa-0.2.2.tar.gz

Download URL regex2dfa-0.2.2.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0b15adbce32667d9edb030bb93c7fa03331e7a33602b4b3ec8a1a5e006800369
BLAKE2b-256 checksum
How to use checksums
9d9788bda8c546181d5731e58562a058a74f078b0018b1d23109d545da2f5853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / regex2dfa-0.2.2-py3-none-any.whl

Download URL regex2dfa-0.2.2-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e09bc167c1b60c4f0314e8b9db5d1e3c65ec01f3f6e44b6a5ea912efb13b1d86
BLAKE2b-256 checksum
How to use checksums
575e2de421400ffe4a345505828c287615e31a0aeeaf1d8c83d48a89c3e45ce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.9

1 release 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