interegular
a regex intersection checker
Decision gist · record as of 2026-08-14
Yes, if you need to detect regex intersections and can work within its constraints. The library is lightweight, has no dependencies, and works on current Python versions. Dormant maintenance is a minor concern but not a blocker for a stable utility. Avoid it if your patterns rely heavily on backreferences, conditionals, or complex lookaheads.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later.
- Some regex features (backreferences, conditional matching, certain lookaheads/lookbacks) are not supported.
- Low friction installation with no runtime dependencies.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.
last release 2024-01-06 (951 days) · last repo commit 2024-06-05 · 58 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,193,419 downloads/mo, #2,144 on PyPI
Alternatives
Verify before relying
pip install interegular
from interegular import compare_regexes
for pattern_a, pattern_b in compare_regexes(r'a+', r'a*b'):
print(f'Intersection: {pattern_a}, {pattern_b}')- Correctness of lookahead/lookbehind handling—documentation notes this is not correctly handled in all cases.
- Performance characteristics when comparing large numbers of complex patterns.
- Completeness of flag support (only i, m, s implemented from aiLmsux).
What it is and what it does
Interegular is a library for detecting whether pairs of Python regular expressions can match overlapping input strings. It parses regex patterns into finite-state machines (FSMs) and compares them to find intersections, returning pairs of patterns that overlap. The library is adapted from grennery but optimized for speed and compatibility with Python's re module syntax.
The package exposes a high-level API (compare_regexes) for quick intersection checks and lower-level Pattern and FSM classes for more detailed analysis. It supports most common regex syntax but explicitly does not handle backreferences, conditional matching, or all lookahead/lookbehind cases—these limitations are inherent to the FSM-based approach. It is useful in parser generators, validation rule analysis, and regex conflict detection.
Use it for
- Detect conflicting patterns in a parser or lexer to warn about ambiguous token definitions.
- Validate that two regex-based validation rules do not overlap in unexpected ways.
- Analyze a set of URL routing patterns to find potential collisions.
- Check whether input sanitization regexes and attack patterns intersect.
- Test regex-based firewall or IDS rules for unintended overlaps.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to detect regex intersections and can work within its constraints.
The library is lightweight, has no dependencies, and works on current Python versions. Dormant maintenance is a minor concern but not a blocker for a stable utility. Avoid it if your patterns rely heavily on backreferences, conditionals, or complex lookaheads.
Install
interegular on PyPI
Before you install
Low friction installation with no runtime dependencies. Maintenance is dormant—last release was 2024-01-06, but the repository remains active and the package supports current Python versions (3.8–3.12).
Requires Python 3.7 or later. Some regex features (backreferences, conditional matching, certain lookaheads/lookbacks) are not supported.
License in practice
MIT license permits commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.
Quickstart
pip install interegular
from interegular import compare_regexes
for pattern_a, pattern_b in compare_regexes(r'a+', r'a*b'):
print(f'Intersection: {pattern_a}, {pattern_b}')
Verify before relying
- Correctness of lookahead/lookbehind handling—documentation notes this is not correctly handled in all cases.
- Performance characteristics when comparing large numbers of complex patterns.
- Completeness of flag support (only i, m, s implemented from aiLmsux).
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 951 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,193,419 / month, #2,144 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: interegular-0.3.3-py37-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 › “regex intersection detection”
- interegularInteregular checks whether pairs of Python regular expressions can…
- greeneryParses and manipulates regular expressions by converting them to…
- pybboxesConverts between bounding box formats (COCO, YOLO, VOC, FiftyOne,…
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 greenery · multiregex · regexploit · rebulk · onigurumacffi · re-assert · hyperscan · flpc · slotscheck