
TEXTAFTER
The TEXTAFTER function returns a string value consisting of all characters that appear after a given substring in the original string value.
TEXTAFTER(source-string, search-string, occurrence)
source-string: Any value.
search-string: The string value to search.
occurrence: An optional value indicating which occurrence of search-string within source-string to match (1 for first match, 2 for second match, …, -1 for last match, -2 for second to last match, …). If omitted, set to 1.
Notes
By default, if there are multiple occurrences of search-string in source-string, TEXTAFTER returns the text starting from (and excluding) the first occurrence.
If search-string isn’t found within source-string, or if the given occurrence can’t be found, an error is returned.
REGEX is permitted in search-string for more complex searches.
By default, the search isn't case sensitive. To consider case in your search, use the REGEX function for search-string.
Examples |
---|
=TEXTAFTER("email: email@example.com", "email: ") returns "email@example.com". =TEXTAFTER("Extract the text after the last occurrence of text like this.", "text", -1) returns " like this." =TEXTAFTER("Get all the text after an email like marina@example.com, this.", REGEX("([A-Z0-9a-z._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})")) returns ", this.". =TEXTAFTER("All the text after the table of contents and introduction"," ",5) returns “table of contents and introduction”. |