The REGEXEXTRACT function in Google Sheets is a powerful tool to extract matching substrings according to a regular expression. With this function, you can easily retrieve specific patterns from your text data. Learn the syntax and usage of REGEXEXTRACT through our comprehensive guide.
Parameters
text: The text or cell containing the text from which you want to extract the substring.regular_expression: The regular expression pattern to search for and extract.
Step-by-Step Tutorial
-
Using
REGEXEXTRACTwith a basic regular expression:- Example:
=REGEXEXTRACT("Hello World!", "Wo.rld") - Result:
World
- Example:
-
Using
REGEXEXTRACTwith a more complex regular expression:- Example: If cell
A1contains the valueToday is 2021-11-01, then=REGEXEXTRACT(A1, "\d{4}-\d{2}-\d{2}")will return2021-11-01.
- Example: If cell
Use Cases and Scenarios
- Data Extraction: Extract specific information from unstructured text data.
- Data Validation: Validate whether data matches a specific pattern.
- URL Parsing: Retrieve specific parts of a URL, such as domain or parameters.
Related Functions
REGEXMATCH: ReturnsTRUEif a text string matches a regular expression pattern.REGEXREPLACE: Replaces text that matches a regular expression pattern with a specified replacement.