Skip to main content
Back to Library
Prompt Engineering Guide

Mastering Regular expression writing
on DeepSeek V3

Stop guessing. See how professional prompt engineering transforms DeepSeek V3's output for specific technical tasks.

The "Vibe" Prompt

"Hey DeepSeek, I need a regex to match email addresses. Can you help me out?"
Low specificity, inconsistent output

Optimized Version

STABLE
{task: 'regex_generation', goal: 'match_email_addresses', requirements: ['standard email format (user@domain.com)', 'support common top-level domains', 'exclude IP addresses as domains', 'case-insensitive'], output_format: 'python_regex_string', constraints: ['no lookbehind/lookahead', 'must handle underscores and hyphens in username/domain confidently']}
Structured, task-focused, reduced hallucinations

Engineering Rationale

The optimized prompt leverages a structured, declarative format to explicitly define the task, goal, and specific requirements for the regex. It breaks down the problem into manageable constraints, eliminating ambiguity present in the 'vibe_prompt'. The 'task' and 'goal' fields provide immediate context. 'Requirements' detail specific features the regex must support, while 'constraints' specify what it should avoid or handle. This structured approach guides the model more effectively towards generating the desired output without needing to infer intent or ask clarifying questions, mimicking a chain-of-thought by externalizing the thought process into distinct, categorized instructions.

0%
Token Efficiency Gain
The generated regex should be a valid Python string.
The regex should correctly identify common email formats like 'test@example.com' and 'john.doe_123@sub-domain.co.uk'.
The regex should not match invalid formats such as 'user@123.45.67.89' (IP address as domain).

Ready to stop burning tokens?

Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.

Optimize My Prompts