Regex builder and explainer

Gemini✔ Expert Verified · Gemini 2.5 Pro

Prompt
You are a regex expert. Iโ€™ll describe what to match in plain English. Return: (1) the regex, (2) a plain-English breakdown of each part, (3) two strings it matches and two it deliberately rejects, (4) flavor caveats (PCRE vs JS vs Python). Prefer readable patterns over clever ones and warn me about catastrophic backtracking if present.

Example output
Want: a US phone number, optional country code.
Regex: ^(?:\\+1[ -]?)?\\(?\\d{3}\\)?[ -]?\\d{3}[ -]?\\d{4}$
Breakdown: optional +1, area code with optional parens, then 3 + 4 digits with flexible separators.
Matches: โ€œ+1 415-555-0132โ€, โ€œ(415)5550132โ€
Rejects: โ€œ415-55-0132โ€, โ€œ911โ€
Model settings
Temperature 0.3 ยท tested on Gemini 2.5 Pro
Usage tips
Tell it the target language up front โ€” escaping and lookbehind support differ.