Regex with Match and Non-Match Test Strings
Writes a regex for your pattern, explains each part and provides 8 strings that should match and 8 that should not.
You get: Working code with an explanation
The prompt
You are a regex specialist who writes patterns that are correct and maintainable. I need a regex that matches this: {describe the pattern to match}. If the regex flavor or language (JavaScript, Python, PCRE, Java, Go) or the exact boundaries are unclear, ask me up to two short questions first. Rules: anchor the pattern when the whole string must match; avoid catastrophic backtracking; make the non-matching strings realistic near-misses, not obvious junk; state clearly anything the regex deliberately does not validate. Output format: 1) Assumptions. 2) The regex in a code block, with flags noted. 3) A table explaining each part of the pattern in plain words. 4) Eight strings that should match, each with a short reason. 5) Eight strings that should not match, each with the reason it fails. 6) Limitations and cases better handled by a parser or validator. 7) A short test snippet in my language I can run. The answer is good if all sixteen strings behave as labeled when I run them.Example output
Tips and common edits
Use when you need a pattern and want proof it works. Describe what should match in plain words, with a couple of real examples if you have them.
Questions about this prompt
More like this
More in CodingArchitecture Decision Record for a Technology Choice
Compares realistic options against your constraints and produces a decision record. The record has a weighted comparison, risks, a reversal plan, and a recommendation the team can approve or challenge.
Explain This Error with Ranked Causes
Explains an error and stack trace in plain words, ranks the three most likely causes and gives a confirming check for each.
SQL Query from Schema and Question
Writes a SQL query that answers your question from your schema, explains each clause and suggests indexes worth adding.
Characterization Tests Before a Refactor
Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.
Codebase Tour for a Specific Task
Explores a repo through the lens of your task and explains the architecture, key files and data flow, then says where to start.
Failing Test First Bug Fix
Reproduces a bug with a failing test, finds the root cause, applies the smallest fix and shows the test passing.
Business Idea Validation Sprint with a $100 Two-Week Test
Turn a business idea and target customer into a ranked list of risky assumptions, five interview questions and a $100 test to run in two weeks.
Positioning and Messaging Hierarchy Builder from Competitor and Customer Evidence
Turns your product facts, customer evidence, and competitor notes into a tested positioning statement, messaging hierarchy, and proof-gap list so a marketing team can decide what to say and what to validate first.
20-Case Agent Eval Set with Pass/Fail Rubric for Normal, Edge and Unsafe Requests
Builds 20 test cases for your agent's task, with expected behavior, failure signals and a pass/fail rubric covering normal, edge and unsafe requests.
Strict JSON Handoff Schemas with Validation and Retry Rules for Agent Pipelines
Turns a pasted pipeline description into JSON schemas for every agent-to-agent handoff, plus validation checks and retry rules for bad output.
Pull Request Review with Merge Recommendation
Reviews a diff against your standards and returns a merge, merge-with-changes, or do-not-merge recommendation. Findings are ranked by severity, with evidence, suggested fixes, and open questions.
Regex Builder With Match and No-Match Test Cases
Builds a regular expression from a plain-English description and example strings, explains each part, and proves it against strings that should and should not match.