Matching text patterns in Excel used to mean learning VBA or hunting for third-party add-ins. That changed with the introduction of native REGEX functions.Excel now includes three REGEX functions — REGEXTEST, REGEXEXTRACT, and REGEXREPLACE — that work just like any other worksheet formula. You can validate, extract, and clean text data using regular expressions directly in your cells, no coding required.
What Are REGEX Functions in Excel?
REGEX (regular expressions) is a syntax for matching text patterns. Excel's REGEX functions let you use this power inside worksheet formulas.Availability:
Excel 365 (Current Channel) — fully available
Excel 2024 — fully available
Excel for the Web — fully available
Excel 2021 or earlier — not available (use VBA or Power Query instead)
The functions were introduced gradually through Microsoft 365 updates starting in late 2024 and are now generally available for all current-channel subscribers.
REGEXTEST — Check If Text Matches a Pattern
The simplest of the three. REGEXTEST returns TRUE if the text matches your pattern and FALSE if it doesn't.Syntax:
=REGEXTEST(text, pattern, [case_sensitivity])
Parameters:
text — the cell or string to check
pattern — your regex pattern (as text)
case_sensitivity — optional. 0 (default, case-sensitive) or 1 (case-insensitive)
Returns TRUE if the cell contains a US phone number pattern like (555) 123-4567 or 555.123.4567.Practical use: Combine REGEXTEST with conditional formatting to highlight rows with invalid data, or use it inside IF for data cleaning:
REGEXEXTRACT pulls out the portion of text that matches your pattern. This is the function you will use most often, especially for text extraction tasks.Syntax:
If cell A2 contains "Order PRD-3842 shipped", this returns PRD-3842.Example 3 — Extract All Matches (return_mode=1):
=REGEXEXTRACT(A2, "\\d+", 1)
If cell A2 contains "Order 3842 contains 5 items", this returns {3842, 5} as a vertical array. You will need Excel's current-channel update for array return support.Example 4 — Capture Groups (return_mode=2):
Returns "NY".All four formulas reference the same source cell and update automatically when your data changes.
Limitations and Tips
Performance
REGEX functions are slower than basic text functions (LEFT, MID, FIND) on large datasets. For 10,000+ rows, use them sparingly or combine with LET to calculate once and reuse — a pattern also used by other modern Excel functions for performance:
Excel's REGEX engine follows the .NET regex syntax, which is similar to Perl but has some differences:
Use \\d for digits (double backslash inside Excel strings)
Use \\w for word characters
Use $1, $2 for capture group references (not \1, \2)
Combine with Other Functions
LET — store your regex pattern once
LAMBDA — create custom regex functions you can reuse
TRIM — clean whitespace before regex processing
Conclusion
Excel's native REGEX functions — REGEXTEST, REGEXEXTRACT, and REGEXREPLACE — turn complex text manipulation tasks into simple worksheet formulas. No VBA, no add-ins, no scripting.I use REGEXEXTRACT the most in my own work, especially when cleaning data exported from other systems. Being able to pull out exactly what I need with one formula saves me a ton of manual editing.Try it now: Open Excel, type a few sample strings, and test each REGEX function. The fastest way to learn is by experimenting with real text patterns.
Topics
Topics in this article
Explore related topics and continue reading similar content.