Regex Builder Comment

Developer Toolscopilot-promptspatternDescriptionvalidExamplesinvalidExamples

Providing both valid and invalid examples lets Copilot generate a precise regex instead of an overly broad one. Starting the const declaration on the next line triggers inline completion with the full pattern.

Prompt
// Build a regex that matches {{patternDescription}}
// Valid examples: {{validExamples}}
// Invalid examples (should NOT match): {{invalidExamples}}
// Flags: {{flags}}
// Return as a named const with a JSDoc comment explaining the pattern

const {{regexName}}: RegExp =

Variables to customize

{{patternDescription}}{{validExamples}}{{invalidExamples}}{{flags}}{{regexName}}

Why this prompt works

Providing both valid and invalid examples lets Copilot generate a precise regex instead of an overly broad one. Starting the const declaration on the next line triggers inline completion with the full pattern.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.