Function: IF_MATCH
Syntax: IF_MATCH(target, regex1, result_if_regex1, [regex2, result_if_regex2], ..., [else_result])
Description: Evaluates the target against a list of regular expressions (regexes) and return the result value from the first matching regex. If no regexes are matched then the else_result is returned (or null if none is specified). All the result values must have the same type.
Note that matching is case-insensitive by default. You can make the regex case sensitive by adding (?c) at the beginning of your regex.
Note that backslashes (\) need to be escaped in strings. So typical regex patterns such as \d will have to be written \\d in regex strings. See the examples below.
Sample usage:
IF_MATCH("foo_bar", "^foo", 1, "^bar", 2)returns1IF_MATCH("bar_foo", "^foo", 1, "^bar", 2)returns2IF_MATCH("some_word", "^foo", 1, "^bar", 2)returnsnull, since no regexes match the target value and there are no fallback valuesIF_MATCH("1234", "\\d+", "number", "^bar", "other")returns"number"IF_MATCH("some_word", "^foo", 1, "^bar", 2, 10)returns10, since it is the fallback valueIF_MATCH(label_names, "(bug|defect)", "bug", "(feat|improvement)", "feature", "other")will reduce labels (e.g. on an issue or PR) to a single keyword using regex matching.IF_MATCH(sub_type, "(bug|defect)", "bug", "(feat|improvement)", "feature", "other")will regroup an issue sub-type (e.g. from Jira) into broader categories using regex matching.
