multiregex
Quickly match many regexes against a string. Provides 2-10x speedups over naïve regex matching.
Decision gist · record as of 2026-08-14
Yes. Low install friction, active maintenance, no security issues, and a clear performance win for the specific problem it solves (matching many regexes). The permissive BSD-3-Clause license poses no restrictions. Worth installing if you routinely match multiple patterns against strings; not necessary for single-pattern matching or if your patterns are already optimized.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Complex regex patterns may require manual prematcher configuration to avoid ValueError.
- Low friction: pure Python wheel with a single runtime dependency (pyahocorasick).
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause (permissive) allows commercial and private use with minimal restrictions; attribution required.
last release 2026-05-20 (86 days) · last repo commit 2026-08-10 · 38 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 79,338 downloads/mo, #14,364 on PyPI
Alternatives
Verify before relying
import multiregex
my_patterns = [r"\w+@\w+\.com", r"\w\.com"]
matcher = multiregex.RegexMatcher(my_patterns)
results = matcher.search("john.doe@example.com")
# Returns list of (re.Pattern, re.Match) tuples- Whether the 2-10x speedup range applies to typical production workloads or only specific pattern/text combinations
- Performance characteristics when matching against very large numbers of patterns (hundreds or thousands)
What it is and what it does
multiregex is a pattern-matching library that accelerates searching for multiple regex patterns in a single string. Instead of running each regex independently, it uses "prematchers"—fast substring checks that predict whether a full regex is likely to match—to skip expensive regex evaluation on non-matching candidates. The library provides three matching modes (search, match, fullmatch) that mirror Python's standard re module, returning sets of (Pattern, Match) tuples for all patterns that matched.
The speedup comes from filtering: prematchers are lists of literal strings that must be present if a regex matches, so multiregex checks for these substrings first and only evaluates the full regex on promising candidates. For simple patterns like r"\w+\.com", prematchers are generated automatically; for complex patterns, you supply your own or disable prematching entirely. The library includes a profiler to measure prematcher effectiveness and identify false positives.
Use it for
- Scan log files or text streams for multiple error/warning patterns without running each regex separately
- Extract multiple entity types (emails, URLs, phone numbers) from documents in a single pass
- Validate input against a ruleset of regex constraints where most rules will not match most inputs
- Build content filters that check text against many blocked-pattern rules efficiently
- Implement multi-pattern search in text editors or code analysis tools
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Low install friction, active maintenance, no security issues, and a clear performance win for the specific problem it solves (matching many regexes). The permissive BSD-3-Clause license poses no restrictions. Worth installing if you routinely match multiple patterns against strings; not necessary for single-pattern matching or if your patterns are already optimized.
Install
multiregex on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (pyahocorasick). Active maintenance with recent commits and no known vulnerabilities.
Requires Python 3.9 or later. Complex regex patterns may require manual prematcher configuration to avoid ValueError.
License in practice
BSD-3-Clause (permissive) allows commercial and private use with minimal restrictions; attribution required.
Quickstart
import multiregex
my_patterns = [r"\w+@\w+\.com", r"\w\.com"]
matcher = multiregex.RegexMatcher(my_patterns)
results = matcher.search("john.doe@example.com")
# Returns list of (re.Pattern, re.Match) tuples
Verify before relying
- Whether the 2-10x speedup range applies to typical production workloads or only specific pattern/text combinations
- Performance characteristics when matching against very large numbers of patterns (hundreds or thousands)
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepyahocorasick |
| Maintenance | Actively maintained 86 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,338 / month, #14,364 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9 |
Evidence: multiregex-2.0.4-py3-none-any.whl
Tags
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 › “match multiple regexes at once”
- multiregexMatches multiple regex patterns against a string efficiently by using…
- greeneryParses and manipulates regular expressions by converting them to…
- interegularInteregular checks whether pairs of Python regular expressions can…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also retrie · rebulk · tfidf-matcher · interegular · ahocorasick-rs · textsearch · regexploit · real-regex · hyperscan · ttp