Skip to main content
idapt
HomeAI ModelsPricing
Sign inStart free
All prompts

Prompt library

Build a regex with tests, not vibes

Regexes fail at their edges, so the adversarial test table is the real deliverable; the regex is almost a byproduct. The not-regular escape hatch stops the classic disaster of forcing grammar-shaped problems into a pattern that almost works.

EngineeringCodeSuggested model: moonshotai/kimi-k2.7-code

Last reviewed July 17, 2026

The prompt
Build a regular expression for this requirement: {{requirement}}

Flavor and where it runs: {{flavor}}

Deliver:
1. The regex.
2. A plain-language walkthrough, token by token, so a reviewer can audit it without simulating it mentally.
3. A test table: at least 6 strings that must match and 6 that must not, chosen adversarially (near-misses, empty string, unicode, doubled delimiters, the too-greedy case). Show expected vs actual per row.
4. Failure modes: inputs where this regex is the wrong tool (nesting, context-dependence) and what to use instead.
5. A stricter and a looser variant, one line each on when to prefer them.

If the requirement is truly not regular (balanced brackets, HTML), say so first and offer the closest safe approximation with its limits.
Run in idaptOpens a new chat with the prompt prefilled. Nothing sends until you press send.

Fill in the variables

VariableWhat it isExample
{{requirement}}What must match and what must notmatch ISO dates (YYYY-MM-DD) inside log lines, but not version strings like 2024-1-5-beta
{{flavor}}Regex flavor / languageJavaScript (used in a Node log parser)

Frequently asked

Related prompts

Write SQL from a plain-language requestDerive test cases from a spec

Ready to get to work?

Free to start. No credit card. Never trained on your data.

Start free
  • Home
  • Pricing
  • AI Models
  • Image models
  • Voice models
  • Video models
  • Rankings
  • New models
  • Model status
  • Multi-Model Chat
  • Voice Mode
  • Voice HUD
  • Web Search
  • Image Generation
  • Video Generation
  • Audio Generation
  • Transcription
  • Drive
  • Secrets
  • Sharing
  • Workspaces
  • Tasks
  • Memory
  • Agents
  • Subagents
  • Automations
  • Skills
  • Code Execution
  • Computers
  • Computer Use
  • Cloud Computers
  • Local AI
  • AI Gateway
  • API & SDK
  • CLI
  • MCP
  • Tunnels
  • All features →
  • Blog
  • Use cases
  • Comparisons
  • Best of
  • Learn
  • Free tools
  • Prompts
  • Templates
  • Changelog
  • Help center
  • FAQ
  • Privacy
  • Compare all models
  • Support
  • Developers
  • Quickstarts
  • API reference
  • API pricing
  • CLI
  • MCP
  • Downloads
  • Desktop
  • Badges and embeds
© idapt[email protected]TermsPrivacy PolicyLegal noticeReport content
X (Twitter)