---
title: "Regex & SQL Deconstructor Prompt: token-by-token breakdowns and edge-case audits."
description: "Download the Regex & SQL Deconstructor JSON preset for Vezz me. Highlight any gnarly regular expression, SQL query, or awk/jq one-liner for a token-by-token breakdown."
canonical_url: "https://vezz.me/prompts/regex-and-sql-deconstructor/"
type: "pseo-prompts"
category: "prompts"
topic: "Developer Syntax Preset"
intent: "Best for backend developers, data engineers, and SREs reviewing regular expressions, complex SQL queries, `jq` filters, and cron schedules."
---

# Regex & SQL Deconstructor Prompt: token-by-token breakdowns and edge-case audits.

Download the Regex & SQL Deconstructor JSON preset for Vezz me. Highlight any gnarly regular expression, SQL query, or awk/jq one-liner for a token-by-token breakdown.

> **Best fit:** Best for backend developers, data engineers, and SREs reviewing regular expressions, complex SQL queries, `jq` filters, and cron schedules.

## Live Webpage Walkthrough

- **Source:** GitHub Pull Request — Order Fraud Filter Query (`github.com/org/checkout/pull/412/files`)
- **Recommended Context Mode:** Basic

**Highlighted Passage:**
> SELECT user_id, amount FROM orders WHERE user_id NOT IN (SELECT user_id FROM blacklisted_users) AND coupon_code ~ '^(?=.*[A-Z])(?=.*\d)[A-Z\d]{8,12}$';

**User Question (Shortcut):** "Deconstruct this expression token-by-token and flag any edge-case bugs."

**Vezz me On-Screen Answer:**
1. **Plain-English Goal**: Selects orders from non-blacklisted users whose coupon is an 8–12 char uppercase alphanumeric string with >=1 letter and >=1 digit.
2. **Token Breakdown**: `^(?=.*[A-Z])` requires an uppercase letter; `(?=.*\d)` requires a digit; `[A-Z\d]{8,12}$` enforces 8–12 uppercase/digit chars.
3. **Test Cases**: Matches `"SAVE2026"`; rejects `"save2026"` (lowercase) and `"VIP26"` (<8 chars).
4. **CRITICAL SQL BUG (`NOT IN` + `NULL`)**: If `blacklisted_users.user_id` contains even a **single `NULL`**, `NOT IN` evaluates to `UNKNOWN` and the entire query returns **0 rows**! Rewrite using `NOT EXISTS (SELECT 1 FROM blacklisted_users b WHERE b.user_id = orders.user_id)`.

**Suggested Follow-Ups:**
- "Rewrite this regex without lookaheads so it compiles in Go's RE2 engine."
- "What composite index on `orders` would optimize this query?"

## Custom Prompt Preset for Vezz me

- **Preset Name:** Regex & SQL Deconstructor
- **Recommended Context Level:** Basic
- **JSON Preset Download:** https://vezz.me/prompts/presets/regex-and-sql-deconstructor.json

```text
Deconstruct the selected regular expression, SQL query, shell pipeline, or cron expression: 1) Plain-English Goal: state in 1 sentence what it matches or computes, 2) Token/Clause Execution Breakdown: explain each token, lookaround, CTE, or window clause in logical execution order, 3) Concrete Test Cases: show 2 inputs that MATCH/SUCCEED and 2 subtle edge cases that FAIL, and 4) Bug & Performance Audit: flag any ReDoS backtracking risk, SQL NULL traps (like `NOT IN` with nullable columns), or index bypasses, with a safer rewrite.
```

**Why it works:** Forces the AI to generate concrete failing test inputs and check for classic silent killers like SQL `NOT IN (NULL)` and Regex catastrophic backtracking.

## Step-by-step workflow

1. **Download and import the JSON preset**: Save `regex-and-sql-deconstructor.json` and import it via the Vezz me extension popup.
2. **Highlight any regex, SQL query, jq filter, or cron schedule**: Select the expression inside a GitHub PR diff, Metabase/Superset editor, or Stack Overflow answer.
3. **Review the failing test cases and NULL/ReDoS audit**: Verify the generated edge cases before merging the expression to production.

## Catch SQL NULL traps and Regex ReDoS before production

Most regular expressions and SQL queries work on happy-path strings. Production outages happen on malformed inputs and nullable columns.

- Flags catastrophic backtracking (`(a+)+$`) that can lock up a Node.js or Python worker on a 40-byte input
- Catches SQL three-valued logic bugs (`NOT IN` with `NULL`, `LEFT JOIN` filtered in `WHERE` instead of `ON`)
- Works equally well on `jq` JSON filters, `awk`/`sed` pipelines, and Kubernetes cron schedules

## Frequently asked questions

### Does this preset also work for bash/awk/jq and cron expressions?

Yes! The prompt explicitly handles regex, SQL, shell pipelines (`awk`, `sed`, `jq`), and cron schedules.

### Can I ask it to convert the regex to a specific flavor (PCRE, JS, Rust, Go RE2)?

Yes—just mention your target runtime if you need a rewrite without lookarounds (e.g., for Go `regexp` / RE2).

### Is this preset free?

All Vezz me JSON prompt presets are 100% free to download, customize, and share.

## Related guides

- [Decode Regex, SQL & Config Files Workflow](https://vezz.me/use-cases/decode-regex-sql-and-config-files/): Full workflow guide for decoding dense syntax in the browser.
- [Senior Engineer Code Reviewer Preset](https://vezz.me/prompts/senior-engineer-code-reviewer/): General code review preset for concurrency, security, and edge cases.
- [Vezz me on Stack Overflow](https://vezz.me/for/stack-overflow/): Verify copy-pasted regexes and SQL snippets on Stack Overflow.
- [Vezz me on GitHub](https://vezz.me/for/github/): Audit PR diffs without leaving the GitHub Files Changed tab.
