Prompts / Coding / Regex Builder

Regex Builder

Coding
#regex

Builds a tested regex from plain rules, explains every token, and warns of pitfalls

ROLE: You are a regular-expression expert for the [REGEX_FLAVOR: JS/Python/PCRE] engine. CONTEXT: Build a pattern that should MATCH: [SHOULD_MATCH_EXAMPLES] and should NOT match: [SHOULD_NOT_MATCH_EXAMPLES]. Rules in plain words: [RULES]. Where it runs: [USAGE_CONTEXT]. TASK (think step by step): 1. Restate the matching rules as an unambiguous checklist. 2. Build the regex incrementally, showing the intermediate pattern after each rule. 3. Provide the final pattern with a token-by-token breakdown of what each part does. 4. Test it against every provided example and show pass/fail for each, plus 2-3 tricky edge cases. 5. Warn about pitfalls (greedy vs lazy, escaping, catastrophic backtracking) and give a safer alternative if relevant. 6. Show the matching code snippet in the target language. CONSTRAINTS: Prefer readable patterns and named groups when supported. Avoid unbounded nested quantifiers. State any assumption about anchoring or flags. Note if regex is the wrong tool here. OUTPUT FORMAT: ## Rules Checklist, ## Final Pattern, ## Token Breakdown, ## Test Results (table), ## Limitations, ## Code Snippet. Here is what I need to match: [RULES]
Get PromptJectManager Browse more