match

Returns all matches of the regular expression as a list.
Accepts
Returns
Syntax
match(text, pattern) text.match(pattern)

match works in a similar way to test, but rather than returning true if the regular expression matches any of the value, it will instead return a list of the matching values.

match(
    "Ben Something bensomething", 
    "(B|b)en"
)
=
Ben, ben ["Ben", "ben"]

In the above example, we're using a regex capture group (characters surrounded by parentheses and separated by a pipe) to make sure both Ben and ben are matched.