prompt
Regex Builder & Explainer
Builds a regular expression from a plain-English description and explains every part.
You are a regex expert. Build a regular expression for {{flavor}} that matches: {{requirement}}. Inputs: - Regex flavor/engine: {{flavor}} (PCRE, JavaScript, Python re, etc.) - What to match (and what NOT to match): {{requirement}} - Test strings (should match / should not): {{test_strings}} Produce: 1. The regex, ready to paste. 2. A token-by-token breakdown (what each part does) so the user can maintain it. 3. Results against {{test_strings}}: which pass, which fail, and why. 4. Common edge cases this pattern does or doesn't handle. Rules: use the correct syntax for {{flavor}}; prefer clarity over cleverness; warn about catastrophic backtracking if the pattern risks it; note when a regex is the wrong tool (e.g. parsing nested HTML).
Variables
{{flavor}}Regex flavor{{requirement}}What to match{{test_strings}}Test stringsExample output
Flavor: JavaScript. Requirement: match a valid hex color (#fff or #ffffff), not #ffff. Regex: /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ Breakdown: - ^ ... $ : anchor whole string. - # : literal hash. - (?: ... | ... ) : non-capturing group, either branch. - [0-9a-fA-F]{3} : exactly 3 hex digits (#fff). - [0-9a-fA-F]{6} : exactly 6 hex digits (#ffffff). Tests: "#fff" pass, "#ffffff" pass, "#ffff" fail (4 isn't 3 or 6), "fff" fail (no #). Edge cases: rejects 4/8-digit RGBA hex by design \u2014 add {4} and {8} branches if you need alpha.
Details
Author
AI Khazna
License
—
Security
Vetted
Type
prompt
Related assets
More curated picks in Development & Code.
npm install @modelcontextprotocol/server-everything
npm install @modelcontextprotocol/server-memory
npm install @modelcontextprotocol/server-filesystem
npm install @modelcontextprotocol/server-git
npm install @modelcontextprotocol/server-fetch
npm install @modelcontextprotocol/server-sequentialthinking
Audit before you install
Run any source through our checks - AI visibility, security, performance, and stack detection.
Automated Web Security Scan
security
PageSpeed Analyzer
performance
AI Content Quality Test
arabic content
AI Agent / MCP Server Tester
ai testing
Site Stack Detector
migration
AI SEO / AEO / GEO Audit
ai visibility
llms.txt Generator
ai visibility
Readability Score
arabic content
Schema / JSON-LD Builder
ai visibility
AI Cost Calculator
ai testing
Headline Analyzer
arabic content