Regex builder with test table, ReDoS check and flavour caveats

par fidji DeepSeek Anglais ~643 tokens
Extrait public Verrouillé
Flavour first (PCRE, JavaScript, Python, Go RE2, .NET), full-string validation or extraction? Build the pattern token by token, run every positive and negative example through it, add edge cases, check nested quantifiers for ReDoS…

À propos de ce prompt

Describe what to match and give examples that must and must not match: the prompt builds the pattern piece by piece, verifies it against every example in a test table, adds the edge cases you forgot, checks for catastrophic backtracking and flavour differences, and says when a regex is the wrong tool. DeepSeek’s step-by-step reasoning suits this kind of verification.

Exemple de résultat

Fourni par l'auteur
STEP 1 — Choices: spaces, dots or nothing between pairs (not mixed); ASCII digits only; whole-string validation. STEP 3 ``` ^(?:\+33\s?|0)(?<lead>[67])(?:[\s.]?\d{2}){4}$ ``` STEP 4 — Tests (excerpt) | Input | Expected | Result | Decided by | | 06 12 34 56 78 | match | match | `0` then `[67]` then 4 × `\s?\d{2}` | | +33 7 12 34 56 78 | match | match | `\+33\s?` | | 0612 34 56 78 | match | match | separators optional per pair (accepted, see note) | | 05 12 34 56 78 | no | no | `[67]` fails on 5 | | "06 12 34 56 78\n" | no | MATCH in PHP | `$` accepts a final newline → use `\z` | Fix: replace `$` with `\z` (PCRE). Re-run: all 14 rows pass. STEP 5 — No nested quantifiers: linear time, safe on untrusted input. Note: `[\s.]?` allows "06.12 34.56 78" (mixed). Strict version with one separator captured and reused: `(?<sep>[\s.]?)…\k<sep>`…

Fiche technique

Modèle
DeepSeek
Langue du prompt
Anglais
Pour qui
Developers, data analysts and sysadmins who need a regular expression they can trust in production
Longueur
~643 tokens (estimation)
Format livré
Texte du prompt, affiché en ligne après achat

Avis

Réservés aux acheteurs

Aucun avis pour l'instant. Seuls les acheteurs de ce prompt peuvent en laisser un.

Signaler ce prompt