MS.REGEXEXTRACT
Description
Extracts text from a string that matches a specified regular expression pattern.
This function is useful for parsing and extracting specific pieces of information from complex text data.
Syntax
MS.REGEXEXTRACT(
text
, pattern
, [return_mode
], [case_sensitivity
]) - text: The text or cell reference containing the text you want to extract strings from.
- pattern: The regular expression that defines the pattern of text you want to extract.
- return_mode: A number that specifies what strings you want to extract. Options include:
- 0 (default): Returns the first string that matches the pattern.
- 1: Returns all strings that match the pattern as an array.
- 2: Returns capturing groups from the first match as an array. Capturing groups are parts of a regex pattern enclosed in parentheses that allow you to return separate parts of a single match individually.
- case_sensitivity: A number that determines whether the match is case-sensitive. Options include:
- 0 (default): Case-sensitive.
- 1: Case-insensitive.