/regex

Writes a pattern (regular expression) to find or clean text.

The full prompt

/regex Write a regular expression (a text-matching pattern) for [where I'll use it, e.g. Google Sheets REGEXEXTRACT, Excel, Python]. It should match: [what to match]. Example text: [sample]. Should not match: [counter-example, if any]. Give the pattern, a ready-to-use formula or line of code, and explain each part in plain words.

Replace the highlighted [brackets] with your own details, then send.

What you're asking

You ask for a text-matching pattern. You get the pattern, a ready formula, and a plain explanation.

Give it

  • Where you'll use it (app or language)
  • What to match, with real-looking examples
  • What should not match

Check: Test the pattern on a handful of rows before running it on everything.

Filled-in example

/regex Write a regular expression (a text-matching pattern) for Google Sheets REGEXEXTRACT. It should match: the 5-digit ZIP code in an address. Example text: "123 Main St, Tampa, FL 33602". Should not match: the street number. Give the pattern, a ready-to-use formula or line of code, and explain each part in plain words.

Use it in any AI chat. The slash word is a label, not a built-in command; the prompt does the work, and answers vary by app. How these work