REGEXTEST Function in Excel: Does Text Match a Pattern?

⏱ 1 min readUpdated 28 September 2026

TextLevel: ExpertAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Related functions

REGEXTEST returns TRUE if text matches a regular expression — validate PAN numbers, emails or codes in one formula.

Syntax

=REGEXTEST(text, pattern, [case_sensitivity])
Argument What it means
pattern A regular expression.

Examples

Example 1

=REGEXTEST(A2, "^[A-Z]{5}[0-9]{4}[A-Z]$")

Checks the PAN format (5 letters, 4 digits, 1 letter).

REGEXEXTRACT · REGEXREPLACE

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong