Regular expressions are used for Pattern Matching.

To use in Excel follow these steps:

Step 1: Add VBA reference to "Microsoft VBScript Regular Expressions 5.5"

  • Select "Developer" tab (I don't have this tab what do I do?)
  • Select "Visual Basic" icon from 'Code' ribbon section
  • In "Microsoft Visual Basic for Applications" window select "Tools" from the top menu.
  • Select "References"
  • Check the box next to "Microsoft VBScript Regular Expressions 5.5" to include in your workbook.
  • Click "OK"

Step 2: Define your pattern

Basic definitions:

- Range.

  • E.g. a-z matches an lower case letters from a to z
  • E.g. 0-5 matches any number from 0 to 5

[] Match exactly one of the objects inside these brackets.

  • E.g. [a] matches the letter a
  • E.g. [abc] matches a single letter which can be a, b or c
  • E.g. [a-z] matches any single lower case letter of the alphabet.

() Groups different matches for return purposes. See examples below.

{} Multiplier for repeated copies of pattern defined before it.

  • E.g. [a]{2} matches two consecutive lower case letter a: aa
  • E.g. [a]{1,3} matches at least one and up to three lower case letter a, aa, aaa

+ Match at least one, or more, of the pattern defined before it.

  • E.g. a+ will match consecutive a's a, aa, aaa, and so on

? Match zero or one of the pattern defined before it.

  • E.g. Pattern may or may not be present but can only be matched one time.
  • E.g. [a-z]? matches empty string or any single lower case letter.

* Match zero or more of the pattern defined before it.

  • E.g. Wildcard for pattern that may or may not be present.
  • E.g. [a-z]* matches empty string or string of lower case letters.

. Matches any character except newline \n

  • E.g. a. Matches a two character string starting with a and ending with anything except \n

| OR operator

  • E.g. a|b means either a or b can be matched.
  • E.g. red|white|orange matches exactly one of the colors.

^ NOT operator

  • E.g. [^0-9] character can not contain a number
  • E.g. [^aA] character can not be lower case a or upper case A

\ Escapes special character that follows (overrides above behavior)

  • E.g. \., \\, \(, \?, \$, \^

Anchoring Patterns:

^ Match must occur at start of string

  • E.g. ^a First character must be lower case letter a
  • E.g. ^[0-9] First character must be a number.

$ Match must occur at end of string

  • E.g. a$ Last character must be lower case letter a

Precedence table:

Order  Name                Representation
1      Parentheses         ( )
2      Multipliers         ? + * {m,n} {m, n}?
3      Sequence & Anchors  abc ^ $
4      Alternation         |

Predefined Character Abbreviations:

abr    same as       meaning
\d     [0-9]         Any single digit
\D     [^0-9]        Any single character that's not a digit
\w     [a-zA-Z0-9_]  Any word character
\W     [^a-zA-Z0-9_] Any non-word character
\s     [ \r\t\n\f]   Any space character
\S     [^ \r\t\n\f]  Any non-space character
\n     [\n]          New line

Example 1: Run as macro

The following example macro looks at the value in cell A1 to see if the first 1 or 2 characters are digits. If so, they are removed and the rest of the string is displayed. If not, then a box appears telling you that no match is found. Cell A1 values of 12abc will return abc, value of 1abc will return abc, value of abc123 will return "Not Matched" because the digits were not at the start of the string.

Private Sub simpleRegex()
    Dim strPattern As String: strPattern = "^[0-9]{1,2}"
    Dim strReplace As String: strReplace = ""
    Dim regEx As New RegExp
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1")
    
    If strPattern <> "" Then
        strInput = Myrange.Value
        
        With regEx
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = strPattern
        End With
        
        If regEx.Test(strInput) Then
            MsgBox (regEx.Replace(strInput, strReplace))
        Else
            MsgBox ("Not matched")
        End If
    End If
End Sub

Example 2: Run as an in-cell function

This example is the same as example 1 but is setup to run as an in-cell function. To use, change the code to this:

Function simpleCellRegex(Myrange As Range) As String
    Dim regEx As New RegExp
    Dim strPattern As String
    Dim strInput As String
    Dim strReplace As String
    Dim strOutput As String
    
    
    strPattern = "^[0-9]{1,3}"
    
    If strPattern <> "" Then
        strInput = Myrange.Value
        strReplace = ""
        
        With regEx
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = strPattern
        End With
        
        If regEx.test(strInput) Then
            simpleCellRegex = regEx.Replace(strInput, strReplace)
        Else
            simpleCellRegex = "Not matched"
        End If
    End If
End Function

Place your strings ("12abc") in cell A1. Enter this formula =simpleCellRegex(A1) in cell B1 and the result will be "abc".


Example 3: Loop Through Range

This example is the same as example 1 but loops through a range of cells.

Private Sub simpleRegex()
    Dim strPattern As String: strPattern = "^[0-9]{1,2}"
    Dim strReplace As String: strReplace = ""
    Dim regEx As New RegExp
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1:A5")
    
    For Each cell In Myrange
        If strPattern <> "" Then
            strInput = cell.Value
            
            With regEx
                .Global = True
                .MultiLine = True
                .IgnoreCase = False
                .Pattern = strPattern
            End With
            
            If regEx.Test(strInput) Then
                MsgBox (regEx.Replace(strInput, strReplace))
            Else
                MsgBox ("Not matched")
            End If
        End If
    Next
End Sub

Example 4: Splitting apart different patterns

This example loops through a range (A1, A2 & A3) and looks for a string starting with three digits followed by a single alpha character and then 4 numeric digits. The output splits apart the pattern matches into adjacent cells by using the (). $1 represents the first pattern matched within the first set of ().

Private Sub splitUpRegexPattern()
    Dim regEx As New RegExp
    Dim strPattern As String
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1:A3")
    
    For Each C In Myrange
        strPattern = "(^[0-9]{3})([a-zA-Z])([0-9]{4})"
        
        If strPattern <> "" Then
            strInput = C.Value
            
            With regEx
                .Global = True
                .MultiLine = True
                .IgnoreCase = False
                .Pattern = strPattern
            End With
            
            If regEx.test(strInput) Then
                C.Offset(0, 1) = regEx.Replace(strInput, "$1")
                C.Offset(0, 2) = regEx.Replace(strInput, "$2")
                C.Offset(0, 3) = regEx.Replace(strInput, "$3")
            Else
                C.Offset(0, 1) = "(Not matched)"
            End If
        End If
    Next
End Sub

Results:


Additional Pattern Examples

String   Regex Pattern                  Explanation
a1aaa    [a-zA-Z][0-9][a-zA-Z]{3}       Single alpha, single digit, three alpha characters
a1aaa    [a-zA-Z]?[0-9][a-zA-Z]{3}      May or may not have preceding alpha character
a1aaa    [a-zA-Z][0-9][a-zA-Z]{0,3}     Single alpha, single digit, 0 to 3 alpha characters
a1aaa    [a-zA-Z][0-9][a-zA-Z]*         Single alpha, single digit, followed by any number of alpha characters

</i8>    \<\/[a-zA-Z][0-9]\>            Exact non-word character except any single alpha followed by any single digit
Answer from Automate This on Stack Overflow
🌐
Ablebits
ablebits.com › ablebits blog › excel › regex › excel regex examples: using regular expressions in formulas
Excel Regex examples: using regular expressions in formulas
March 9, 2023 - Put the pattern in A2 and you'll get the job done with this compact and elegant formula: =RegExpExtract(A5, $A$2) If a pattern is matched, the formula extracts an invoice number, if no match is found - nothing is returned. For more examples, please see: How to extract strings in Excel using regex.
🌐
Microsoft Community Hub
techcommunity.microsoft.com › microsoft community hub › communities › products › microsoft 365 › microsoft 365 insider blog
New Regular expression (Regex) functions in Excel
January 31, 2025 - Hey, Microsoft 365 Insiders! My name is Jake Armstrong, and I’m a Product Manager on the Excel team. I’m excited to announce the availability of three new functions that use Regular Expressions to help parse text more easily: REGEXTEST, REGEXEXTRACT, and REGEXREPLACE.
People also ask

How do I use regex in Excel?
Excel 365 has three native regex functions: REGEXEXTRACT pulls matching text, REGEXREPLACE finds and swaps patterns, and REGEXTEST checks if text matches a pattern. All three use PCRE2 syntax and work in Excel for Windows, Mac, and the web.
🌐
xelplus.com
xelplus.com › home › tutorials › how to use regex in excel: regexextract, regexreplace & regextest
How to Use Regex in Excel: REGEXEXTRACT, REGEXREPLACE & REGEXTEST
Which Excel versions support REGEXEXTRACT, REGEXREPLACE, and REGEXTEST?
The three REGEX functions are available in Microsoft 365 (Excel for Windows, Mac, and Web). They are not supported in Excel 2021, 2019, or earlier perpetual-license versions. Users on older versions will see a #NAME? error.
🌐
xelplus.com
xelplus.com › home › tutorials › how to use regex in excel: regexextract, regexreplace & regextest
How to Use Regex in Excel: REGEXEXTRACT, REGEXREPLACE & REGEXTEST
What is the difference between REGEXEXTRACT and REGEXTEST?
REGEXTEST returns TRUE or FALSE to check whether text matches a pattern. REGEXEXTRACT returns the actual matching text from the string. Use REGEXTEST for validation (e.g., is this a valid email?) and REGEXEXTRACT when you need to pull the matched text into another cell.
🌐
xelplus.com
xelplus.com › home › tutorials › how to use regex in excel: regexextract, regexreplace & regextest
How to Use Regex in Excel: REGEXEXTRACT, REGEXREPLACE & REGEXTEST
🌐
Exceljet
exceljet.net › home › articles › regular expressions in excel
Regular Expressions in Excel | Exceljet
June 30, 2025 - After decades of waiting, Excel finally supports Regular Expressions, aka regex! Learn how three powerful new functions - REGEXTEST, REGEXREPLACE, and REGEXEXTRACT - can transform complex text operations into elegant, maintainable formulas. Whether you're cleaning data, validating inputs, or extracting patterns, these new tools will change how you write advanced formulas in Excel.
Top answer
1 of 2
1167

Regular expressions are used for Pattern Matching.

To use in Excel follow these steps:

Step 1: Add VBA reference to "Microsoft VBScript Regular Expressions 5.5"

  • Select "Developer" tab (I don't have this tab what do I do?)
  • Select "Visual Basic" icon from 'Code' ribbon section
  • In "Microsoft Visual Basic for Applications" window select "Tools" from the top menu.
  • Select "References"
  • Check the box next to "Microsoft VBScript Regular Expressions 5.5" to include in your workbook.
  • Click "OK"

Step 2: Define your pattern

Basic definitions:

- Range.

  • E.g. a-z matches an lower case letters from a to z
  • E.g. 0-5 matches any number from 0 to 5

[] Match exactly one of the objects inside these brackets.

  • E.g. [a] matches the letter a
  • E.g. [abc] matches a single letter which can be a, b or c
  • E.g. [a-z] matches any single lower case letter of the alphabet.

() Groups different matches for return purposes. See examples below.

{} Multiplier for repeated copies of pattern defined before it.

  • E.g. [a]{2} matches two consecutive lower case letter a: aa
  • E.g. [a]{1,3} matches at least one and up to three lower case letter a, aa, aaa

+ Match at least one, or more, of the pattern defined before it.

  • E.g. a+ will match consecutive a's a, aa, aaa, and so on

? Match zero or one of the pattern defined before it.

  • E.g. Pattern may or may not be present but can only be matched one time.
  • E.g. [a-z]? matches empty string or any single lower case letter.

* Match zero or more of the pattern defined before it.

  • E.g. Wildcard for pattern that may or may not be present.
  • E.g. [a-z]* matches empty string or string of lower case letters.

. Matches any character except newline \n

  • E.g. a. Matches a two character string starting with a and ending with anything except \n

| OR operator

  • E.g. a|b means either a or b can be matched.
  • E.g. red|white|orange matches exactly one of the colors.

^ NOT operator

  • E.g. [^0-9] character can not contain a number
  • E.g. [^aA] character can not be lower case a or upper case A

\ Escapes special character that follows (overrides above behavior)

  • E.g. \., \\, \(, \?, \$, \^

Anchoring Patterns:

^ Match must occur at start of string

  • E.g. ^a First character must be lower case letter a
  • E.g. ^[0-9] First character must be a number.

$ Match must occur at end of string

  • E.g. a$ Last character must be lower case letter a

Precedence table:

Order  Name                Representation
1      Parentheses         ( )
2      Multipliers         ? + * {m,n} {m, n}?
3      Sequence & Anchors  abc ^ $
4      Alternation         |

Predefined Character Abbreviations:

abr    same as       meaning
\d     [0-9]         Any single digit
\D     [^0-9]        Any single character that's not a digit
\w     [a-zA-Z0-9_]  Any word character
\W     [^a-zA-Z0-9_] Any non-word character
\s     [ \r\t\n\f]   Any space character
\S     [^ \r\t\n\f]  Any non-space character
\n     [\n]          New line

Example 1: Run as macro

The following example macro looks at the value in cell A1 to see if the first 1 or 2 characters are digits. If so, they are removed and the rest of the string is displayed. If not, then a box appears telling you that no match is found. Cell A1 values of 12abc will return abc, value of 1abc will return abc, value of abc123 will return "Not Matched" because the digits were not at the start of the string.

Private Sub simpleRegex()
    Dim strPattern As String: strPattern = "^[0-9]{1,2}"
    Dim strReplace As String: strReplace = ""
    Dim regEx As New RegExp
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1")
    
    If strPattern <> "" Then
        strInput = Myrange.Value
        
        With regEx
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = strPattern
        End With
        
        If regEx.Test(strInput) Then
            MsgBox (regEx.Replace(strInput, strReplace))
        Else
            MsgBox ("Not matched")
        End If
    End If
End Sub

Example 2: Run as an in-cell function

This example is the same as example 1 but is setup to run as an in-cell function. To use, change the code to this:

Function simpleCellRegex(Myrange As Range) As String
    Dim regEx As New RegExp
    Dim strPattern As String
    Dim strInput As String
    Dim strReplace As String
    Dim strOutput As String
    
    
    strPattern = "^[0-9]{1,3}"
    
    If strPattern <> "" Then
        strInput = Myrange.Value
        strReplace = ""
        
        With regEx
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = strPattern
        End With
        
        If regEx.test(strInput) Then
            simpleCellRegex = regEx.Replace(strInput, strReplace)
        Else
            simpleCellRegex = "Not matched"
        End If
    End If
End Function

Place your strings ("12abc") in cell A1. Enter this formula =simpleCellRegex(A1) in cell B1 and the result will be "abc".


Example 3: Loop Through Range

This example is the same as example 1 but loops through a range of cells.

Private Sub simpleRegex()
    Dim strPattern As String: strPattern = "^[0-9]{1,2}"
    Dim strReplace As String: strReplace = ""
    Dim regEx As New RegExp
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1:A5")
    
    For Each cell In Myrange
        If strPattern <> "" Then
            strInput = cell.Value
            
            With regEx
                .Global = True
                .MultiLine = True
                .IgnoreCase = False
                .Pattern = strPattern
            End With
            
            If regEx.Test(strInput) Then
                MsgBox (regEx.Replace(strInput, strReplace))
            Else
                MsgBox ("Not matched")
            End If
        End If
    Next
End Sub

Example 4: Splitting apart different patterns

This example loops through a range (A1, A2 & A3) and looks for a string starting with three digits followed by a single alpha character and then 4 numeric digits. The output splits apart the pattern matches into adjacent cells by using the (). $1 represents the first pattern matched within the first set of ().

Private Sub splitUpRegexPattern()
    Dim regEx As New RegExp
    Dim strPattern As String
    Dim strInput As String
    Dim Myrange As Range
    
    Set Myrange = ActiveSheet.Range("A1:A3")
    
    For Each C In Myrange
        strPattern = "(^[0-9]{3})([a-zA-Z])([0-9]{4})"
        
        If strPattern <> "" Then
            strInput = C.Value
            
            With regEx
                .Global = True
                .MultiLine = True
                .IgnoreCase = False
                .Pattern = strPattern
            End With
            
            If regEx.test(strInput) Then
                C.Offset(0, 1) = regEx.Replace(strInput, "$1")
                C.Offset(0, 2) = regEx.Replace(strInput, "$2")
                C.Offset(0, 3) = regEx.Replace(strInput, "$3")
            Else
                C.Offset(0, 1) = "(Not matched)"
            End If
        End If
    Next
End Sub

Results:


Additional Pattern Examples

String   Regex Pattern                  Explanation
a1aaa    [a-zA-Z][0-9][a-zA-Z]{3}       Single alpha, single digit, three alpha characters
a1aaa    [a-zA-Z]?[0-9][a-zA-Z]{3}      May or may not have preceding alpha character
a1aaa    [a-zA-Z][0-9][a-zA-Z]{0,3}     Single alpha, single digit, 0 to 3 alpha characters
a1aaa    [a-zA-Z][0-9][a-zA-Z]*         Single alpha, single digit, followed by any number of alpha characters

</i8>    \<\/[a-zA-Z][0-9]\>            Exact non-word character except any single alpha followed by any single digit
2 of 2
245

To make use of regular expressions directly in Excel formulas the following UDF (user defined function) can be of help. It more or less directly exposes regular expression functionality as an excel function.

How it works

It takes 2-3 parameters.

  1. A text to use the regular expression on.
  2. A regular expression.
  3. A format string specifying how the result should look. It can contain $0, $1, $2, and so on. $0 is the entire match, $1 and up correspond to the respective match groups in the regular expression. Defaults to $0.

Some examples

Extracting an email address:

=regex("Peter Gordon: [email protected], 47", "\w+@\w+\.\w+")
=regex("Peter Gordon: [email protected], 47", "\w+@\w+\.\w+", "$0")

Results in: [email protected]

Extracting several substrings:

=regex("Peter Gordon: [email protected], 47", "^(.+): (.+), (\d+)$", "E-Mail: $2, Name: $1")

Results in: E-Mail: [email protected], Name: Peter Gordon

To take apart a combined string in a single cell into its components in multiple cells:

=regex("Peter Gordon: [email protected], 47", "^(.+): (.+), (\d+)" & 1)
=regex("Peter Gordon: [email protected], 47", "^(.+): (.+), (\d+)" & 2)

Results in: Peter Gordon [email protected] ...

How to use

To use this UDF do the following (roughly based on this Microsoft page. They have some good additional info there!):

  1. In Excel in a Macro enabled file ('.xlsm') push ALT+F11 to open the Microsoft Visual Basic for Applications Editor.
  2. Add VBA reference to the Regular Expressions library (shamelessly copied from Portland Runners++ answer):
    1. Click on Tools -> References (please excuse the german screenshot)
    2. Find Microsoft VBScript Regular Expressions 5.5 in the list and tick the checkbox next to it.
    3. Click OK.
  3. Click on Insert Module. If you give your module a different name make sure the Module does not have the same name as the UDF below (e.g. naming the Module Regex and the function regex causes #NAME! errors).

  4. In the big text window in the middle insert the following:

    Function regex(strInput As String, matchPattern As String, Optional ByVal outputPattern As String = "$0") As Variant
        Dim inputRegexObj As New VBScript_RegExp_55.RegExp, outputRegexObj As New VBScript_RegExp_55.RegExp, outReplaceRegexObj As New VBScript_RegExp_55.RegExp
        Dim inputMatches As Object, replaceMatches As Object, replaceMatch As Object
        Dim replaceNumber As Integer
    
        With inputRegexObj
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = matchPattern
        End With
        With outputRegexObj
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
            .Pattern = "\$(\d+)"
        End With
        With outReplaceRegexObj
            .Global = True
            .MultiLine = True
            .IgnoreCase = False
        End With
    
        Set inputMatches = inputRegexObj.Execute(strInput)
        If inputMatches.Count = 0 Then
            regex = False
        Else
            Set replaceMatches = outputRegexObj.Execute(outputPattern)
            For Each replaceMatch In replaceMatches
                replaceNumber = replaceMatch.SubMatches(0)
                outReplaceRegexObj.Pattern = "\$" & replaceNumber
    
                If replaceNumber = 0 Then
                    outputPattern = outReplaceRegexObj.Replace(outputPattern, inputMatches(0).Value)
                Else
                    If replaceNumber > inputMatches(0).SubMatches.Count Then
                        'regex = "A to high $ tag found. Largest allowed is $" & inputMatches(0).SubMatches.Count & "."
                        regex = CVErr(xlErrValue)
                        Exit Function
                    Else
                        outputPattern = outReplaceRegexObj.Replace(outputPattern, inputMatches(0).SubMatches(replaceNumber - 1))
                    End If
                End If
            Next
            regex = outputPattern
        End If
    End Function
    
  5. Save and close the Microsoft Visual Basic for Applications Editor window.

🌐
Excel University
excel-university.com › home › blog › match text patterns with regex
Match Text Patterns with REGEX - Excel University
August 27, 2024 - The REGEXREPLACE function allows you to replace text matching a specific pattern with a new text string. ... Let’s say you want to replace all but the last 4 credit card digits with ****-****-****. Pattern Explanation: For the pattern, use \d+-\d+-\d+. Formula: =REGEXREPLACE(A2, "\d+-\d+-\d+", "****-****-****")
🌐
XelPlus
xelplus.com › home › tutorials › how to use regex in excel: regexextract, regexreplace & regextest
How to Use Regex in Excel: REGEXEXTRACT, REGEXREPLACE & REGEXTEST
All three use PCRE2 syntax and work in Excel for Windows, Mac, and the web. No VBA, add-ins, or Insider channel required. This guide covers the full syntax for each function, 9 copy-ready formula examples (emails, dates, URLs, credit card formatting, leading zeros, special characters), and a downloadable regex ...
Published: April 16, 2026
Find elsewhere
🌐
Trump Excel
trumpexcel.com › home › excel functions › regex functions in excel
REGEX Functions in Excel (10 Examples)
July 15, 2026 - You can use the REGEXREPLACE function in Excel to find a pattern and replace it with something else. This replacement could be a completely different string or a different format of the pattern REGEXREPLACE has found. Below I have a data set where I have some phone numbers in different formats in column A, and I want them all in the standard (XXX) XXX-XXXX format. ... REGEXREPLACE(A2, “[^\d+]”, “”) – This part of the formula removes everything that is not a digit and gives us only the numbers as one continuous string
🌐
Ablebits
ablebits.com › ablebits blog › excel › regex › excel regex: match strings using regular expressions
Excel Regex: match strings using regular expressions
March 10, 2023 - By default, a regular expression is added to the formula, but you can also keep it in a separate cell. For this, just use a cell reference for the 2nd argument. By default, the function is case-sensitive. For case-insensitive matching, use the (?i) pattern. For more information, please see AblebitsRegexMatch function. That's how to do regular expression matching in Excel. I thank you for reading and look forward to seeing you on our blog next week! Excel Regex Match examples (.xlsm file) Ultimate Suite 14-day fully-functional version (.exe file)
🌐
TeachExcel
teachexcel.com › excel-tutorial › 2285 › regular-expression-search-formula-in-excel-regex
Regular Expression Search Formula in Excel - Regex - TeachExcel.com
How to Make a Regular Expression Match or Search in Excel using a single Formula - this formula allows you to decide which characters are allowed, if they can be capital or lower-case, and much more and requires no VBA or Macros!
🌐
Globalexcelsummit
globalexcelsummit.com › post › introducing-the-new-regex-function-set-in-excel
Introducing the new REGEX function set in Excel
September 16, 2025 - REGEXTEST checks if the supplied text matches a regex pattern and returns TRUE or FALSE. ... A list of codes are displayed in A3:A12. There are ones composed of numbers, letters, and a mixture of both. To return TRUE for the codes that contain a number and FALSE for the ones that don't, use the following formula:‍
🌐
WPS Office
wps.com › blog › how-to-use-regular-expressions-regex-in-excel-3-examples
How to Use Regular Expressions (REGEX) in Excel? (3 Examples)
October 16, 2025 - Unfortunately, there are no built-in REGEX functions in Excel. This means that you cannot use REGEX directly in formulas or functions like FIND, REPLACE, SEARCH, etc. However, some ways to use REGEX in Excel with some workarounds still exist.
🌐
Microsoft Support
support.microsoft.com › en-us › office › regextest-function-7d38200b-5e5c-4196-b4e6-9bff73afbd31
REGEXTEST Function | Microsoft Support
REGEXEXTRACT always return text values. You can convert these results back to a number with the VALUE function. Copy the example data and paste it in cell A1 of a new Excel worksheet.
🌐
How-To Geek
howtogeek.com › home › microsoft › how to use the regex functions in excel
How to Use the REGEX Functions in Excel
January 1, 2025 - If I didn't include the dollar symbols, Excel would simply return "2, 1" as the result in each cell. I haven't addressed arguments k and l in the above formula because I want Excel to replace all occurrences (the default for argument k), and I want the replacement to be case-sensitive (the default for argument l).
🌐
Microsoft Support
support.microsoft.com › en-us › office › regexextract-function-4b96c140-9205-4b6e-9fbe-6aa9e783ff57
REGEXEXTRACT Function | Microsoft Support
REGEXEXTRACT always return text values. You can convert these results back to a number with the VALUE function. Copy the example data and paste it in cell A1 of a new Excel worksheet.
🌐
Exceldashboardschool
exceldashboardschool.com › home › regex in excel
Regex in Excel - Excel Dashboard School
April 13, 2025 - This includes writing formulas like “if cell contains”. Checking these used to be a cumbersome task. I emphasize, used to be… ... case_sensitivity: Determines whether the match is case-sensitive. By default, the match is case-sensitive. ... Let’s get into the good stuff—actual regex use cases in Excel.
🌐
My Online Training Hub
myonlinetraininghub.com › home › blog › excel regex functions
Excel REGEX Functions • My Online Training Hub
May 18, 2025 - The input in the cell is he output of the following formula: DATEDIF(B2,C2+1,”Y”)&” years “&DATEDIF(B2,C2+1,”YM”)&” months”&DATEDIF(B2,C2+1,”MD”)&” days” · The years, months and days are either double and single digits. I want to extract only the digits in 3 adjacent columns (one column of the number of years, second column of the number of months and 3 column for the number of days). For this purpose I used TOROW&REGEXEXTRACT and got the following error “#N/A”. For the REGEXEXTRACT pattern I used “d/+” .
🌐
DataCamp
datacamp.com › tutorial › excel-regex-tutorial
Excel Regex Tutorial: Mastering Pattern Matching with Regular Expressions | DataCamp
December 14, 2023 - By enabling macros in your Excel workbook, you can now use the CustomRegExpExtract function like a regular function in Excel to parse complex string patterns, where: ... instanceNumber returns all instances of the pattern, by default, but an integer can be entered to specify the number of instances to return; and · matchCase specifies whether to consider text case during matching (TRUE or omitted) or to disregard it (FALSE). Let's say we're interested in extracting phone numbers from a field. We can type the regex pattern in any cell (in the case below, it appears in cell A2).
🌐
ExcelDemy
exceldemy.com › home › advanced excel › how to use regex to match patterns in excel – 6 examples
How to Use REGEX to Match Patterns in Excel - 6 Examples - ExcelDemy
August 6, 2024 - REGEX will be: the total character length – 9, the first 3 – uppercase letters, the next 3 – numeric values, and the last 3 – lowercase letters. Go to Formulas>> Defined Names >> Name Manager.
🌐
Exceljet
exceljet.net › home › formulas › xlookup with regex match
XLOOKUP with regex match - Excel formula | Exceljet
January 4, 2025 - To use a regex pattern in an XLOOKUP formula, you can enable "regex match" as the match mode and then provide a regex pattern in the lookup value. In the worksheet shown, the formula in F5 looks like this: =XLOOKUP("[A-Z]{3}"&F4&"[A-Z]{2}",...