Watch our latest video available on Youtube.
Tutorials/Tutorials / Formulas

How to Use REGEX Formulas in Airtable

Airtable ships three regex functions — REGEX_MATCH, REGEX_EXTRACT, and REGEX_REPLACE — and they are the most powerful, most misunderstood formulas in the whole platform. This guide walks through the syntax, the RE2 engine gotcha that breaks half the regex patterns you'll find online, and ten copy-paste patterns for real business problems.

Advanced15 min readApr 9, 2026

Regular expressions are the quiet superpower of Airtable. They can validate phone numbers, extract IDs from messy text, strip whitespace, normalize data on the way in, and clean up imports that would otherwise require a scripting step or a round-trip through a spreadsheet.

But they also have sharp edges. The first time you drop a regex pattern from Stack Overflow into an Airtable formula field and it silently refuses to match anything, you start to suspect the platform is lying to you. It isn't — Airtable is just running a different regex engine than most online tutorials assume.

This guide covers all three of Airtable's regex functions, explains the RE2 engine gotcha in plain English, and gives you ten copy-paste patterns for real business problems. If you need the complete formula reference, start with our Airtable formulas cheat sheet.

The Three Functions

Airtable supports exactly three regex functions. Every regex use case in Airtable is some combination of them.

REGEX_MATCH — Does the pattern match?

Syntax: REGEX_MATCH(text, regex)

Returns 1 (true) if the pattern is found anywhere in the text, 0 (false) otherwise. Use it for validation and flagging.

REGEX_MATCH({Email}, '^[^@\s]+@[^@\s]+\.[^@\s]+$')

REGEX_EXTRACT — Pull out the first match

Syntax: REGEX_EXTRACT(text, regex)

Returns the first substring that matches the pattern, or blank if nothing matches. Use it to pull IDs, codes, numbers, and other structured bits out of free text.

REGEX_EXTRACT({Order Note}, '\d{6,}')

REGEX_REPLACE — Substitute all matches

Syntax: REGEX_REPLACE(text, regex, replacement)

Replaces every match with the replacement string and returns the result. Use it for cleaning, normalizing, and reformatting text.

REGEX_REPLACE({Phone}, '[^\d]', '')

See Airtable's official guide to REGEX functions for the full reference.

The RE2 Gotcha Everyone Hits First

Before we do anything else, let's defuse the biggest trap.

Airtable's regex functions are implemented using the RE2 regular expression library — the same engine used internally by Google and built into the Go programming language. RE2 is a safe, fast, linear-time regex engine. It's designed to prevent the catastrophic backtracking that can crash servers when someone feeds a malicious pattern into a PCRE-based engine.

The tradeoff is that RE2 doesn't support a few features most regex tutorials assume you have:

  • No lookbehind. (?<=...) and (?<!...) will throw an error.
  • No backreferences in the pattern. You can't use \1 to reference a previous capture group in the match portion. (You can use $1 in the replacement portion of REGEX_REPLACE.)
  • No possessive quantifiers. a++ isn't valid.
  • Limited Unicode property support. Some \p{...} classes work, others don't.

For 95% of business use cases — validation, extraction, cleanup — none of this matters. But it matters enormously when you grab a "perfect" regex from Stack Overflow and paste it into Airtable and nothing happens.

The fix: when you're developing regex patterns, use regex101.com and set the flavor dropdown on the left side to Golang. That flavor is the closest match to Airtable's RE2 engine. Patterns that work in regex101's Golang mode will almost always work in Airtable.

Pattern Library: 10 Copy-Paste Regex Formulas

These are patterns we use on almost every client engagement. Copy, paste, adjust field names, ship.

1. Validate an email address

IF(
  REGEX_MATCH({Email}, '^[^@\s]+@[^@\s]+\.[^@\s]+$'),
  '✅ Valid',
  '❌ Invalid'
)

This pattern isn't RFC-compliant (no email regex really is), but it catches 99% of typos and malformed addresses in practice. If you need stricter validation, use a dedicated email verification service via Make or Zapier — regex alone will never be enough.

2. Normalize a phone number to digits only

REGEX_REPLACE({Phone}, '[^\d]', '')

Strips everything that isn't a digit. (555) 123-4567 becomes 5551234567. Perfect for deduplication, matching against external systems, or SMS sends.

3. Validate a phone number after normalizing

IF(
  REGEX_MATCH(REGEX_REPLACE({Phone}, '[^\d]', ''), '^\d{10,15}$'),
  '✅ Valid',
  '❌ Check Format'
)

The inner REGEX_REPLACE strips non-digits; the outer REGEX_MATCH checks that what's left is 10 to 15 digits (a reasonable international range). Composing regex functions like this is the key to clean data pipelines.

4. Extract an order ID from free text

REGEX_EXTRACT({Note}, 'ORD-\d{4,}')

If your customers reply to emails with "Re: Your order ORD-48129 has shipped", this formula pulls ORD-48129 into its own field automatically. Change the prefix and digit count to match your own ID scheme.

5. Extract the first email from a longer string

REGEX_EXTRACT({Contact Info}, '[^\s@]+@[^\s@]+\.[^\s@]+')

Common when you're ingesting signature blocks, contact forms, or CRM exports where the email is buried in prose.

6. Extract a URL

REGEX_EXTRACT({Description}, 'https?://[^\s)]+')

Grabs the first http:// or https:// URL from a string. Stops at whitespace or a closing paren (useful if the URL is inside parentheses).

7. Check if a string contains any digit

REGEX_MATCH({Password}, '\d')

Returns 1 if the value contains at least one digit. Useful for password complexity checks, invoice number validation, or flagging records where a reference code is missing.

8. Strip all HTML tags

REGEX_REPLACE({HTML Content}, '<[^>]*>', '')

If you're importing rich-text content from a CMS or email system, this flattens it to plain text. Not perfect — it won't decode HTML entities — but it's 80% of what most people want.

9. Collapse multiple spaces into one

TRIM(REGEX_REPLACE({Messy Text}, '\s+', ' '))

Replaces runs of any whitespace (spaces, tabs, newlines) with a single space, then trims the ends. The go-to cleanup when pasted data comes in with weird formatting.

10. Extract a hashtag from social copy

REGEX_EXTRACT({Post Body}, '#\w+')

Pulls the first hashtag out of a piece of social content. Chain multiple REGEX_EXTRACT formulas with different patterns if you need more than one.

Combining Regex with Other Formulas

Regex is most powerful when you combine it with IF, TRIM, UPPER, and other formula functions. Here are two real patterns we've shipped to clients.

Pattern: Extract and format at the same time

IF(
  REGEX_MATCH({Raw Input}, '\d{3}-\d{3}-\d{4}'),
  'US-' & REGEX_EXTRACT({Raw Input}, '\d{3}-\d{3}-\d{4}'),
  'Needs Review'
)

Matches US-formatted phone numbers, prefixes them with US-, and flags everything else for human review. Great for import pipelines.

Pattern: Category from keyword presence

IF(
  REGEX_MATCH(LOWER({Subject}), '(refund|return|chargeback)'),
  'Billing',
  IF(
    REGEX_MATCH(LOWER({Subject}), '(login|password|access)'),
    'Account',
    IF(
      REGEX_MATCH(LOWER({Subject}), '(broken|bug|error|crash)'),
      'Technical',
      'General'
    )
  )
)

Classifies inbound tickets by keyword presence in the subject line. Note the LOWER() wrap — makes the match case-insensitive without needing the (?i) inline flag. Both approaches work.

Pattern: Case-insensitive with inline flag

REGEX_REPLACE({Text}, '(?i)error', 'ERROR')

The (?i) inline flag tells RE2 to treat the rest of the pattern as case-insensitive. Supported flags in RE2 include (?i) (case-insensitive), (?s) (dot matches newline), and (?m) (multiline mode).

Debugging Regex in Airtable

When a pattern isn't working the way you expect, run through this checklist:

  1. Test on regex101.com with Golang flavor. Anything else may lie to you.
  2. Check escape characters. Inside Airtable's single-quoted strings, some characters need doubled backslashes. \\d is safer than \d when you're unsure.
  3. Make sure you're not using lookbehind or backreferences. RE2 doesn't support them.
  4. Wrap the input in TRIM() and LOWER() when debugging to rule out whitespace and case mismatches.
  5. Print the raw input. Add a temporary formula field that just shows LEN({Field}) & ' chars: ' & {Field} so you can see exactly what the regex is seeing.

When Regex Isn't the Right Tool

Regex is perfect for string-level pattern matching. It's a poor choice for structured parsing. If you need to pull fields out of JSON, CSV, or HTML, don't reach for REGEX_EXTRACT — use an Airtable automation with a scripting step, or a Make scenario that uses native JSON/CSV modules. You'll save yourself hours of debugging.

Likewise, if your "regex" is getting longer than two lines, it's usually a sign that the data upstream is the real problem. Fix the data source if you can. Regex should be the last line of defense, not the architecture.

Clean Data Is a Competitive Advantage

Most Airtable bases we're asked to rescue have the same underlying problem: data came in messy, nobody cleaned it on the way in, and now three years later there are five different formats for the same field. Regex functions in Airtable let you fix that at the point of entry — a validation field, a normalized version, a flag for human review.

Ship it early and your database stays sane. Bolt it on late and you're doing archaeology.

If you're staring at a base full of inconsistent phone numbers, malformed emails, or freeform text fields that should have been structured, Business Automated does Airtable data cleanup and migration every week. We'll audit what you've got, write the regex so you don't have to, and set up guardrails that keep the base clean going forward.

Frequently Asked Questions

Common questions about this tutorial.

Ready to Transform Your Business Operations?

Join 100+ companies that have automated their way to success. Get started today and see the difference.