top of page
Kyle Pew

REGEXEXTRACT - Microsoft Excels New Regular Expression Function


Microsoft has recently introduced a new function within Microsoft Excel called REGEXEXTRACT() (Regular Expression).


Check out the video below for a quick example of working with the REGEXEXTRACT() function in Microsoft Excel.



"The REGEXEXTRACT function allows you to extract text from a string based on a supplied regular expression. You can extract the first match, all matches or capturing groups from the first match."



SYNTAX


REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])


text - The text or reference to a cell containing the text you want to extract strings from.

pattern - The regular expression that describes the pattern of text you want to extract.

[return_mode] - A number that specifies what strings you want to extract.

0: Return the first string that matches the pattern.

1: Return all strings that match the pattern.

2: Return capturing groups from the first match as an array.

[case_sensitivity] - Determines whether the match is case-sensitive.

0: Case Sensitive

1: Case Insensitive



REGEX (Regular Expression) CHEAT SHEET


CHARACTER CLASSES


[ ... ] - One of the characters in the brackets.

EXAMPLE

[AEIOU] - Match one of the characters found in the brackets.

[A-Z] - Match an uppercase letter between letters A and Z.

[a-z] - Match a lowercase letter between letters a and z.

[A-Za-z] - Match an uppercase or lowercase letter between letters a and z.


WHITESPACE


/s - Match whitespace character (Space, Tab, Newline, Carriage Return)

/t - Match a tab character


QUANTIFIERS


+ - Match one or more.

EXAMPLE

[a-z]+ - Match one or more letters between a and z.


* - Match zero or more.

EXAMPLE

\s* - Match zero or more whitespace character such as a space.




DOWNLOAD EXAMPLE FILE




1,088 views0 comments

Recent Posts

See All

Comments


bottom of page