Regex is incredibly powerful and versatile. I’ll share some resources, a challenge and several techniques that are helping me learn.
Read more: Unlock the power of regex in ExcelWhat is Regex?
Regex (aka Regular Expressions) finds, extracts, and validates text using patterns instead of exact words. It evolved from a mathematical concept into a practical tool for text processing.
Why learn Regex?
Q: Why should we spend time learning regex syntax?
A: Even basic regex knowledge can save hours of work.
Regex in Microsoft Excel 365
Regex was introduced in Excel in 2024. Three functions use regex syntax:
Regex Intro Resources
Start with regex theory from Mynda Treacy, Leila Gharani, Dave Burns, and Sumit Bansal:
- MyOnlineTrainingHub: excel-regex-functions
- MyOnlineTrainingHub: regex-regular-expressions-excel
- MyOnlineTrainingHub: Excel Regex Cheatsheet
- Xelplus: Regex in Excel
- Xelplus: Introducing REGEX Excel functions
- Exceljet: REGEXEXTRACT function
- TrumpExcel: New Excel REGEX Functions are INSANELY Powerful
Don’t memorize too much theory. Solve problems as soon as possible!
Like learning a language: speak ASAP! Learn basic grammar, speak, repeat. Some regex theory, practice, more theory, more practice. Let’s review a challenge!
Regex LinkedIn Challenge
Challenge Definition
From Mohammad Abou Daher: split column A text into three columns: ID, Capital, State Code.

Complex Solution
Mohammad’s solution is brilliant but the average Excel user wouldn’t understand this:
=REDUCE({"ID","Capital","State Code"}, A3:A12,
LAMBDA(x,y,
VSTACK(x,
LET(
a, TEXTJOIN("",, IFERROR(MID(y, SEQUENCE(LEN(y)),1)*1,"")),
b, CONCAT(REGEXEXTRACT(y,"[A-Z]{2}")),
c, SUBSTITUTE(SUBSTITUTE(y,a,""),b,""),
HSTACK(a,c,b)
)
)
)
)
LAMBDA function is fascinating but complex. Let’s solve it an easier way that most users will understand.
Less Complex Solutions
First, I’ll solve it using three separate formulas.
Then, I’ll combine all three formulas into a single formula.
Three Separate Formulas
Formula 1: cell D3

=REGEXEXTRACT(A3:A12,”^[0-9]+”)

- text: range A3:A12 causes formula to spill results to row 12 (or use A3 and drag formula down)
- pattern: “^[0-9]+”
- ^ the pattern must start at the beginning of a cell
- [0-9] digits from zero to nine
- + take all continuous digits from the start of the pattern
- [return_mode] and [case_sensitivity] are optional and not needed
Formula 2: cell F3

=REGEXEXTRACT(A3:A12,”[A-Z]{2}”)

- text: range A3:A12 causes formula to spill results to row 12 (or use A3 and drag formula down)
- pattern: “[A-Z]{2}”
- [A-Z] upper case text from A to Z
- {2} take ONLY the first two letters
- [return_mode] and [case_sensitivity] are optional and not needed
Formula 3: cell E3

=TEXTAFTER(A3:A12,D3#&F3#)

- text: range A3:A12 causes cell E3 formula to spill results to row 12
- delimiter: D3#&F3# (cell E3: take whatever comes after “1042TX” in cell A3)
- concatenate cell D3 value with cell F3 value
- # symbol: concatenate spill values below cells D3 and F3
- other function arguments are optional and not needed
These formulas solve the challenge and are easier to understand and explain to others. Why is this important? Because spreadsheets are passed around to different departments and companies.
Single Formula
=LET(
Titles, {"ID","Capitol","State Code"},
Text, A3:A12,
ID, REGEXEXTRACT(Text,"^[0-9]+"),
State_Code, REGEXEXTRACT(Text,"[A-Z]{2}"),
Capital, TEXTAFTER(Text, ID&State_Code),
Stack, HSTACK(ID, Capital, State_Code),
Final, VSTACK(Titles, Stack),
Final)
It looks complex doesn’t it? I’ll explain it from the beginning.
Single Formula Step 1
Cell I3 LET function allows us to define all 3 formulas inside 1 formula.
# spill character isn’t used. HSTACK horizontally stacks them.

Single Formula Step 2
In step 1, I repeat range A3:A12 in each formula. Now, variable Text is used in each formula. I can reuse the formula and change the range once.

Single Formula Step 3
Lastly, I created variable Titles for the column headers. Variable Final uses VSTACK to place column headers on top of the columns.

Now that we’ve solved a regex problem, what’s next? Let’s use AI to study regex examples and then experiment with sample text!
Tools to Continue Learning
Modern tools make it SO much easier to ramp up our regex skills!
Use AI to create regex examples
I used Perplexity AI on my phone with this prompt:
Create a list of 1000 regex sample solutions using Microsoft Excel regex functions
Perplexity created groups. Below, the first 15 examples in group ‘Basic pattern matching’
1. Basic pattern matching (1–60)
=REGEXEXTRACT(A2,"[0-9]+")(extract first number sequence)=REGEXEXTRACT(A2,"[A-Za-z]+")(extract first contiguous letters)=REGEXEXTRACT(A2,"^[0-9]+")(extract leading digits)=REGEXEXTRACT(A2,"[0-9]+$")(extract trailing digits)=REGEXEXTRACT(A2,"^\s*[A-Za-z]+")(extract first word, ignoring leading spaces)=REGEXEXTRACT(A2,"\b\w+\b")(extract first word using word boundary)=REGEXEXTRACT(A2,"\b\d{4}\b")(extract 4‑digit number, e.g., year)=REGEXEXTRACT(A2,"\b[A-Fa-f0-9]{6}\b")(extract 6‑digit hex)=REGEXEXTRACT(A2,"[A-Z]{3}")(extract first 3 capital letters)=REGEXEXTRACT(A2,"[A-Za-z]{2,}")(extract first word with 2+ letters)=REGEXEXTRACT(A2,"[aeiouAEIOU]")(extract first vowel)=REGEXEXTRACT(A2,"[^0-9]+")(extract first non‑numeric run)=REGEXEXTRACT(A2,"[^A-Za-z]+")(extract first non‑letter run)=REGEXEXTRACT(A2,".{5}")(extract first 5 characters)=REGEXEXTRACT(A2,"^.{3}")(extract first 3 characters)
I study the examples and occasionally lookup syntax definition. It’s great!
regexr.com
I’m using regexr.com to practice. I love it!
There’s a sample expression, text and explanation. ([A-Z])/w+ highlights words with an upper case letter. Top left area has helpful features to explore.
Modify the expression and observe the results. Here are some I made:
- ([e-f])]w+
- ([c-h)\W+
- (^[E-Z])\w+
- ([a-z^])\w+
Ensure ‘Explain’ is selected below. The explanations are really helpful!

Next, I logged in via google account and started exploring with a new set of sample text.
a[^aeiou] highlights a lower case a followed by anything except lower case aeiou.

In Excel, I used the expression inside function REGEXEXTRACT:
Cell B6 formula counts the occurrences of any lower case letters followed by anything except aeiou.

regex101.com
regex101.com is a similar site where you can practice regex expressions. \b\w{4}b highlights words with a length of 4 characters.

In Excel, this formula extracts all four letter words:
=REGEXEXTRACT(A2,”\b\w{4}\b”,1)
I kept experimenting late last night past 1am!
I’ll now learn more theory in a different area like numbers, email, url, dates etc. and use these tools to practice with a new set of sample data!
Conclusion
Knowing even a few basic regex patterns can save hours of work!
Complex expressions require work to build but remember how we solved things before regex! Slowly and painfully using basic string manipulation functions.
About Me
Me and a very friendly cat named Ox. My cousin loves animals and volunteers at a cat shelter. I wish I could have adopted Ox but my dogs Cali and Fenton would have protested!

I love learning patterns in Excel, Chess, Spanish grammar, Kakuro etc. It’s fun. I know it’s an over used phrase but I really am I life long learner. I’m not happy if I’m not learning something.












































