regex-tester
Skill1 starsChanged 3 months agoMITView on GitHub
Use when the user wants to test a regex pattern against sample text, needs a regex built from a natural-language description, or has a regex that isn't matching as expected — triggers include "test this regex", "write a regex for", or "why isn't my regex working".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- microsoft/agent-frameworktheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- microsoft/agent-framework★ 15ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-test-suiteSkill
- ascii-artSkill
- caddy-reverse-proxySkill
- changelog-generatorSkill
- color-palette-generatorSkill
- cron-taskSkill
- csv-toolkitSkill
- discord-bot-buildSkill
- docker-umbrellaSkill
- dotfiles-manageSkill
- email-sendSkill
- env-config-managerSkill
- excalidraw-diagramSkill
- file-organizerSkill
- forgejo-self-hostSkill
- frontend-design-toolkitSkill
- generate-dockerfileSkill
- gif-searchSkill
- git-backupSkill
- github-actions-ciSkill
- hallmark-readmeSkill
- http-api-testerSkill
- invoice-generatorSkill
- json-formatterSkill
- log-analyzerSkill
- markdown-linterSkill
- markdown-to-pdfSkill
- markdown-to-slidesSkill
- mcp-server-buildSkill
- media-id-mappingSkill
- movie-catalogue-siteSkill
- movie-night-calendarSkill
- ntfy-notifierSkill
- ocr-documentsSkill
- ollama-localSkill
- openapi-generatorSkill
- password-generatorSkill
- pdf-extractSkill
- portfolio-upkeepSkill
- qr-code-generatorSkill
- resume-builderSkill
- rss-monitorSkill
- searxng-self-hostSkill
- skill-publishSkill
- skill-registry-catalogSkill
- skills-portfolio-scaffoldSkill
- snippet-managerSkill
- sqlite-dashboardSkill
- streaming-provider-embedsSkill
- tailscale-deploySkill
- telegram-bot-buildSkill
- tmdb-metadataSkill
- uptime-kuma-self-hostSkill
- watchlist-syncSkill
- webhook-receiverSkill
- youtube-transcriptSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Test, debug, and build regular expressions.
- Distinctive: line 159
Test the pattern against sample text
- Distinctive: line 161
If no matches, debug: explain the pattern and suggest fixes
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
regex-tester
Overview
Test, debug, and build regular expressions. The agent creates regex patterns from descriptions, tests them against sample text, explains what they match, and helps fix patterns that don't work as expected.
When to Use
- The user wants to test a regex pattern against text.
- The user needs help writing a regex for a specific pattern.
- The user has a regex that isn't matching correctly.
- The user says "test this regex", "write a regex for", or "why isn't my regex working".
Test a Regex
import re
def test_regex(pattern: str, text: str, flags: list = None) -> dict:
"""Test a regex pattern against text and return detailed results."""
flag = 0
if flags:
if 'i' in flags: flag |= re.IGNORECASE
if 'm' in flags: flag |= re.MULTILINE
if 's' in flags: flag |= re.DOTALL
if 'x' in flags: flag |= re.VERBOSE
try:
compiled = re.compile(pattern, flag)
except re.error as e:
return {"valid": False, "error": str(e), "pattern": pattern}
matches = list(compiled.finditer(text))
return {
"valid": True,
"pattern": pattern,
"match_count": len(matches),
"matches": [
{
"match": m.group(0),
"start": m.start(),
"end": m.end(),
"groups": m.groups(),
"named_groups": m.groupdict(),
}
for m in matches
],
"highlighted": highlight_matches(text, matches),
}
def highlight_matches(text: str, matches) -> str:
"""Return text with matches wrapped in markers."""
result = []
last_end = 0
for m in matches:
result.append(text[last_end:m.start()])
result.append(f"[{m.group(0)}]")
last_end = m.end()
result.append(text[last_end:])
return ''.join(result)Common Patterns
PATTERNS = {
"email": r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}",
"url": r"https?://[^\s<>"']+[^\s<>"'.]",
"ipv4": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"ipv6": r"(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}",
"phone_us": r"\+?1?[-.\s]?\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})",
"date_iso": r"\d{4}-\d{2}-\d{2}",
"date_us": r"\d{1,2}/\d{1,2}/\d{2,4}",
"time": r"\d{1,2}:\d{2}(?::\d{2})?(?:\s?[AP]M)?",
"uuid": r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
"hex_color": r"#[0-9a-fA-F]{6}\b",
"credit_card": r"\b(?:\d[ -]*?){13,16}\b",
"zipcode_us": r"\b\d{5}(?:-\d{4})?\b",
"semver": r"\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?(?:\+[a-zA-Z0-9.]+)?",
"mac_address": r"([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})",
}Build Regex from Description
The agent can construct patterns from natural language descriptions:
def build_regex(description: str) -> str:
"""Build a regex from a natural language description.
This is a guide — the agent constructs the pattern based on understanding."""
# The agent interprets the description and constructs the pattern
# Examples of what the agent can build:
examples = {
"match email addresses": PATTERNS["email"],
"find all urls": PATTERNS["url"],
"extract dates in YYYY-MM-DD format": PATTERNS["date_iso"],
"match a phone number": PATTERNS["phone_us"],
"find hex color codes": PATTERNS["hex_color"],
"match semver versions": PATTERNS["semver"],
}
return examples # The agent selects or constructs the appropriate patternExplain a Regex
def explain_regex(pattern: str) -> str:
"""Break down a regex pattern into human-readable components."""
explanations = {
r'\d': "any digit (0-9)",
r'\w': "any word character (a-z, A-Z, 0-9, _)",
r'\s': "any whitespace",
r'.': "any character",
r'*': "zero or more of the preceding",
r'+': "one or more of the preceding",
r'?': "zero or one of the preceding",
r'{n}': "exactly n of the preceding",
r'{n,m}': "between n and m of the preceding",
r'^': "start of string/line",
r'$': "end of string/line",
r'[]': "character class",
r'()': "capture group",
r'(?:)': "non-capturing group",
r'(?=)': "lookahead",
r'(?!)': "negative lookahead",
r'|': "alternation (OR)",
r'\\': "literal backslash",
}
# The agent walks through the pattern and explains each component
return "See pattern breakdown in the response"Replace with Regex
def regex_replace(pattern: str, text: str, replacement: str, count: int = 0) -> str:
"""Replace matches with a replacement string."""
return re.sub(pattern, replacement, text, count=count or 0)Workflow
- Understand what the user wants to match
- Either the user provides a pattern to test, or the agent builds one
- Test the pattern against sample text
- Show matches with positions and groups
- If no matches, debug: explain the pattern and suggest fixes
- Return the working pattern and match results
Common Pitfalls
- Greedy vs. lazy confusion.
.*is greedy (matches as much as possible);.*?is lazy (matches as little as possible) — the most common regex bug. - Missing anchors. Without
^and$, the pattern matches anywhere in the string, not the whole thing — add anchors when a full-string match is intended. - Unescaped special characters.
.matches any character; to match a literal dot use\.— a frequent source of over-broad matches. - Catastrophic backtracking. Nested quantifiers like
(a+)+can cause exponential matching time on certain inputs — avoid nesting quantifiers. - Character class range mistakes.
[a-z]is lowercase only;[A-Za-z]covers both cases;[\w]also includes digits and underscore. - Unicode surprises.
\win Python 3 matches Unicode word characters by default — use[a-zA-Z0-9_]when ASCII-only matching is required.
Verification Checklist
- Pattern compiles without a
re.error - Tested against both matching and non-matching sample inputs, not just the happy path
- Match count and capture groups match what the user described wanting
- Checked for catastrophic backtracking risk if the pattern has nested quantifiers
- Anchoring (
^/$) behavior matches whether a full-string or partial match was intended
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

