$npx skillfedfor your agent

exrex

Irregular methods for regular expressions

With conditionsPyPI UtilitiesReleased Nov 2024518.5K downloads / moAGPLv3+Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — exrex-0.12.0-py3-none-any.whl
v0.12.0 · released 2024-11-13

Yes, if you need to generate test data or validate regex patterns. The zero-dependency design and generator-based memory efficiency make it low-risk to add. However, the AGPLv3+ license requires careful review if you plan to distribute code that incorporates it; for internal testing or CLI use, this is less of a concern. No known vulnerabilities and active maintenance support the choice.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Infinite patterns (e.g., [a-z]+) are limited by exrex's maximum length setting; patterns with unbounded repetition will be truncated.
  • Low friction: pure Python with no runtime dependencies, distributed as a wheel.
  • Last commit 2026-02-24 with active maintenance status.

License · maintenance · safety

AGPLv3+ (agpl) — Licensed under AGPLv3+. This is a copyleft license requiring derivative works and modifications to be released under the same terms; consider this carefully if you plan to distribute code that uses exrex.

last release 2024-11-13 (639 days) · last repo commit 2026-02-24 · 957 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 518,516 downloads/mo, #6,220 on PyPI

Verify before relying

pip install exrex

import exrex

# Generate a random matching string
print(exrex.getone('(ex)r\\1'))

# Generate all matching strings
print(list(exrex.generate('((hai){2}|world!)')))

# Count matching strings
print(exrex.count('[01]{0,9}'))
  • Whether the package handles all modern regex features (lookahead, lookbehind, named groups) or only a subset of the re module
  • Performance characteristics on complex patterns with large match spaces
Same gist for agents: .md · .json

What it is and what it does

Exrex is a Python module and CLI tool that works backward from a regular expression to generate matching strings. Instead of testing whether a string matches a pattern, it produces strings that will match. It can enumerate all possible matches (useful for testing), pick random ones (useful for fuzzing), count how many exist, or simplify the pattern itself. The package uses generators to keep memory usage constant regardless of how many matches exist, making it practical for patterns with large or infinite match spaces.

The tool is pure Python with no external dependencies, making it trivial to install. It supports both programmatic use through functions like `getone()`, `generate()`, and `count()`, and direct command-line invocation with options to limit output, write to files, or run in random mode. Patterns with infinite repetition (like `[a-z]+`) are handled by capping the maximum length of those parts.

Use it for

  • Generate test data matching a regex pattern for unit tests or property-based testing frameworks
  • Fuzz testing: produce random strings matching an input format to find edge cases in parsers or validators
  • Verify regex correctness by examining all or a sample of strings the pattern actually matches
  • Simplify complex regex patterns to equivalent but more readable forms for documentation or refactoring
  • Count the number of possible matches for a pattern to understand its scope or validate assumptions

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to generate test data or validate regex patterns.

The zero-dependency design and generator-based memory efficiency make it low-risk to add. However, the AGPLv3+ license requires careful review if you plan to distribute code that incorporates it; for internal testing or CLI use, this is less of a concern. No known vulnerabilities and active maintenance support the choice.

Install

exrex on PyPI

Before you install

Low friction: pure Python with no runtime dependencies, distributed as a wheel. Last commit 2026-02-24 with active maintenance status.

Infinite patterns (e.g., [a-z]+) are limited by exrex's maximum length setting; patterns with unbounded repetition will be truncated.

License in practice

Licensed under AGPLv3+. This is a copyleft license requiring derivative works and modifications to be released under the same terms; consider this carefully if you plan to distribute code that uses exrex.

Quickstart

pip install exrex

import exrex

# Generate a random matching string
print(exrex.getone('(ex)r\\1'))

# Generate all matching strings
print(list(exrex.generate('((hai){2}|world!)')))

# Count matching strings
print(exrex.count('[01]{0,9}'))

Verify before relying

  • Whether the package handles all modern regex features (lookahead, lookbehind, named groups) or only a subset of the re module
  • Performance characteristics on complex patterns with large match spaces

Package facts

LicenseAGPLv3+ agpl
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 639 days since the last release
Last repo commit
First released
Downloads518,516 / month, #6,220 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaEnvironment :: ConsoleLicense :: OSI Approved :: GNU Affero General Public License v3Programming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Topic :: Utilities

Evidence: exrex-0.12.0-py3-none-any.whl

Tags

Capabilities
regex string generatorgenerate strings from regexrandom regex matchesregex pattern matching stringscount regex matchessimplify regular expressions
Topics
regex-testingtest-data-generation
PyPI keywords
regexpgeneratorsstringgenerationregexsimplification

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “regex string generator”

  • exrexExrex generates all or random strings matching a given regular…
  • rstrGenerates random strings from custom alphabets, predefined character…
  • python-string-utilsProvides functions to validate, manipulate, and generate…

Give your agent the search over MCP, or paste the wish link into any chat.

More Utilities packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
Pygments Worth it
PyPI · Utilities · released Mar 2026

Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.

Install it if you need to display or transform source code.

BSD-2-Clausepure Python · 3.9+
1.3Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo

See also repath · rstr · stringparser · greenery · iregexp-check · regex · regress · rebulk · pytest-regex · argparse-ext