arrays.filter_regex_contains

Supported in:
arrays.filter_regex_contains(array_of_strings, regex[, inverse=false])

Description

Filters the contents of the provided array to include only elements that contain the provided regular expression if the inverse is false or exclude elements if the inverse is true.

Param data types

ARRAY_STRINGS, STRING, BOOL

Return type

ARRAY_STRINGS

Code samples

Here are some examples of how to use the function:

Example 1

This example filters out anything that does not end in "inky".

arrays.filter_regex_contains(["inky", "pinky", "blinky", "clyde"], ".*inky$", false) = ["inky", "pinky", "blinky"]
Example 2

This example filters out anything that does end in "inky".

arrays.filter_regex_contains(["inky", "pinky", "blinky", "clyde"], ".*inky$", true) = ["clyde"]
Example 3

This example filters out everything.

arrays.filter_regex_contains(["inky", "pinky", "blinky", "clyde"], "NOT_PRESENT", false) = [""]