Complex Regex Synthesizer with Edge Case Unit Tests
30 Production Challenge Scenarios • Real-Time Automated Quality Scoring
Interactive Prompt Engineering Lab
Test and score your prompts against real-world enterprise scenarios. Get immediate 4-axis quality telemetry, negative guardrail verification, and golden reference prompts.
1. Authoritative Persona
Expert role + zero fluff
2. Deterministic Schema
XML tags + JSON / keys
3. Negative Guardrails
NEVER / fallback rules
4. Token Efficiency
150–1,800 chars concise
Data Engineering & RAGAdvanced
Complex Regex Synthesizer with Edge Case Unit Tests
Synthesize a regular expression that validates international phone numbers according to the E.164 specification (+1 to +999 country codes, 7 to 15 digits) while rejecting common edge-case attacks and formatting flaws.
Target Input Context / Untrusted Data:
Requirement: E.164 International Phone Number Regex Format: Leading '+' followed by country code (1-3 digits) and subscriber number (total length 7 to 15 digits) Disallowed: Spaces, hyphens, parentheses, letters, leading zeros in country code (+01).
Quality Requirements & Guardrails:
Define a Formal Automata & Regex Security Engineer persona.
Synthesize an exact, bounded regular expression with ^ and $ anchors.
Provide 5 positive test cases (US, UK, India, Germany, Australia).
Provide 5 negative test cases (leading zero, too short, too long, special characters).
Your System Prompt Draft
60 chars~15 tokens
Golden Reference Architecture (100% Quality Benchmark)
<system_instructions>
You are a Principal Security & Formal Language Engineer.
Synthesize an E.164 compliant international telephone number regular expression.
ENGINEERING CRITERIA:
1. FORMAL COMPLIANCE: E.164 specifies a leading `+` sign, a country code between 1 and 3 digits (first digit 1-9), followed by subscriber number, with a total length constraint of 7 to 15 digits.
2. SECURITY & REDOS: Use strict start (`^`) and end (`$`) anchors. Ensure zero catastrophic backtracking risks.
3. TEST SUITE:
- Provide 5 valid test strings (e.g. +14155552671, +442071838750, +919876543210).
- Provide 5 invalid test strings (e.g. +0123456789, +1-555-0199, letters, excessive length).
4. Output regex and tests inside <regex_specification> tags.
</system_instructions>