Match Text | TEXT_MATCH

Syntax

TEXT_MATCH( [value], [search] )

Parameters

value
The TEXT value

search
The TEXT value to be searched for. It may also be a string representing a regular expression to match using a pattern.

Return Value

A LIST of TEXT values that are the matched results.

Description

Extract a part or parts of a TEXT value.

Examples

TEXT_MATCH() # returns []
TEXT_MATCH("InstaLink.io", "link.io") # returns ["link.io"]
TEXT_MATCH("InstaLog.io", "link.io") # returns []
TEXT_MATCH("apple banana", "/ba\\w+/") # returns ["banana"]
TEXT_MATCH("Apple Banana", "/ba\\w+/i") # returns ["Banana"]
When the `g` flag is present, each result is returned as an array
TEXT_MATCH("Sam Charles Sarah", "/sa\\w+/ig") # returns [["Sam"], ["Sarah"]]
It can also be used with matching groups, in which case the full match is the first result and all matched groups are the subsequent results.
TEXT_MATCH("Once upon a midnight dreary", "/a (.+) (.+)/")
# returns ["a midnight dreary", "midnight", "dreary"]
You can use the `g` flag and capturing groups together
TEXT_MATCH("The lion sat on a lime", "/li(\w{2})/g")
# returns [["lion", "on"], ["lime", "me"]]