Automation Guide

Regex in Zapier and Make: Extract Emails, Phones, and IDs From Text

Emails, forms, and notes often bury the one value you need inside a block of text. A regular expression pulls it out reliably, with no AI cost and the same result every time.

RegexFormatterZapierMake

By Troy Tessalone · · 9 minutes

Text Parsing

A practical field guide from Automation Ace.

The short answer

A regular expression (regex) is a pattern that describes the shape of the text you want, such as “ORD- followed by five digits.” In Zapier, use the Formatter Extract Pattern action, or a Code step for more control. In Make, use the Text parser → Match pattern module, or the replace() function in a mapping. Test every pattern against real samples, including messy ones, before it goes live.

Regex basics in five minutes

SymbolMeaningExample
\dAny digit\d\d\d matches 123
\wLetter, digit, or underscore\w+ matches Order_42
\sSpace, tab, or line breakOrder:\s* allows any spacing
+ / * / ?One or more / zero or more / optional\d+ matches any whole number
{5}Exactly five times\d{5} matches a US ZIP code
( )Capture group: the part you want backOrder:\s*(\d+) returns just the number
\bWord boundary\bINV\d+\b avoids partial matches
\.A literal dot (escape special characters)\$\d+\.\d{2} matches $19.99

A capture group is the key idea for automation. The pattern finds the right spot, and the group returns only the value, without the label around it.

Zapier: Formatter Extract Pattern

In Zapier, add a Formatter by Zapier step, choose Text, then the Extract Pattern transform. Map the text into Input and enter your pattern. The step returns the match and each capture group as separate fields you can map in later steps. Turn on the option to match all occurrences when you need every match, not just the first.

Before writing a pattern, check Formatter's ready-made Text transforms for extracting an email address, phone number, URL, or number. They cover the most common cases without regex. See Zapier built-in tools.

Zapier: Code steps for more control

A Code step is better when you need to clean the result, return a default, or handle several patterns at once:

const text = inputData.body || '';
const match = text.match(/Order(?:\s*#|:)\s*([A-Z]{3}-\d{5})/i);
const emails = text.match(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi) || [];
output = {
  order_id: match ? match[1].toUpperCase() : '',
  first_email: emails[0] || '',
  all_emails: emails.join(', ')
};

Always return a value, even when nothing matches, so later steps get an empty field rather than nothing. See why a Code step returns undefined and parsing strings in Code steps.

Make: Match pattern and replace()

  • Text parser → Match pattern: enter the pattern and map the text. Turn on global match to return every match, and case-insensitive when capitalization varies. Each match comes back as a bundle with its capture groups, so add an aggregator if you need them in one field.
  • replace() in a mapping: pass a pattern between slashes to clean text in place, for example replace(phone; /\D/g; emptystring) to keep only digits.

See the Make guide for complex workflows for when to move logic into code instead.

Ready-to-use patterns

ValuePattern
Email address[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}
US phone number\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}
Value after a labelCompany:\s*(.+)
Order ID like ORD-12345\bORD-\d{5}\b
Dollar amount\$\s?(\d{1,3}(?:,\d{3})*(?:\.\d{2})?)
URLhttps?://[^\s"<>]+
Date like 2026-10-21\b\d{4}-\d{2}-\d{2}\b

These patterns are practical, not perfect. The email pattern, for example, won't accept every valid address. Adjust them to the formats your data actually uses. After extracting a date or amount, convert it with Formatter. See adjusting dates with Formatter.

Testing tips

  • Collect real samples, including odd ones: forwarded emails, replies with signatures, values with extra spaces, and text with two matches.
  • Test in a regex tester first, using the flavor that matches your tool. Zapier Formatter and Python Code steps use Python-style regex, while JavaScript Code steps and Make use JavaScript-style regex. Most simple patterns work in both.
  • Be specific. .* grabs as much as it can, so prefer [^\n]+ to stop at the end of a line, or add ? to match as little as possible.
  • Handle no match with a filter, a default value, or a path that sends the item for review.
  • Don't parse HTML or JSON with regex. Convert HTML to plain text first, and parse JSON with a JSON step. See parsing JSON in Code steps.

Regex vs AI extraction

Use regex when the value has a predictable shape, such as an ID, email, phone, amount, or date. It's fast, free, and gives the same answer every time. Use AI when the text varies widely or the value depends on meaning, such as “the customer's main complaint.” A good middle ground is to try regex first and send only the items that don't match to an AI step. If you use AI, check its output. See why an AI step returns invalid JSON and web parsing use cases.

Frequently asked questions

Where can I use regex in Zapier?

Use the Formatter by Zapier Text action called Extract Pattern for a no-code option, or a Code by Zapier step with JavaScript or Python for more control, such as returning every match or cleaning the result.

Where can I use regex in Make?

Use the Text parser Match pattern module to extract values, with options for global and case-insensitive matching, or use the replace function in a mapping to clean text with a pattern.

Do I need regex if Zapier already extracts emails and phone numbers?

Not always. Formatter has ready-made extract actions for emails, phone numbers, URLs, and numbers. Use regex when you need something those don't cover, such as order IDs, invoice numbers, or a value next to a specific label.

When should I use AI instead of regex?

Use regex when the value has a predictable shape, because it is fast, free, and gives the same answer every time. Use AI when the text is unpredictable or the value depends on meaning, and validate the AI's output.

RegexFormatterZapierMake

Disclaimer: Zapier and Make features and option names change over time; confirm current details in each vendor's documentation. This article may include links to apps, products, or services; some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the workflow, integration, AI assist, or code bridge that fits your business.

Start a Project →