Wauvel

Excel like a finance pro.

← The library

Text function

REGEXTEST

Tests whether text matches a regular expression.

OccasionalDifficulty 1500 · AdvancedUsage rank #230 of 520
Practice · 3 questions →

When to use it

TRUE when text matches a regular expression. Validation of emails, codes, and formats.

The shape of it

Syntax
=REGEXTEST(text, pattern, [case_sensitivity])

Worked examples

  • Email

    =REGEXTEST("blake@example.com","^[\w.]+@[\w.]+\.\w+$") TRUE

    A simple email check.

  • SKU format

    =REGEXTEST("AB-123","^[A-Z]{2}-\d{3}$") TRUE

    Two letters, dash, three digits.

  • Case insensitive

    =REGEXTEST("Hello","hello",1) TRUE

    Mode 1 ignores case.

Worth knowing

  • Use in Data Validation custom rules for live format checks.
  • Anchor with ^ and $ to test the whole cell.
  • Requires Microsoft 365 (2024).

Where it goes wrong

  • #VALUE! for an invalid pattern.
  • Without anchors, a partial match returns TRUE.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.