200052
New Contributor II

I wanted to share my solution to this, hope this helps. 

Create a SQL function that accepts an ARRAY<STRING>, extracts a numeric ID enclosed in parentheses from the end of each string, and returns an ARRAY<BIGINT>.

Example Usage

Input: ["Item (1)", "Item (99)", "Complex Item (105) - Review"]

Output: [1, 99, 105]

 
CREATE OR REPLACE FUNCTION extract_numeric_ids(arr ARRAY<STRING>)
RETURNS ARRAY<BIGINT>
RETURN transform(
arr,
x -> cast(regexp_extract(x, '\\((\\d+)\\)[^\\(]*$', 1) as bigint)
);​

Now replace each of your legacy params which would have return the id to use this subquery.

SELECT
  id
FROM
  rangeme.certification_groups
WHERE
  array_contains(
    extract_numeric_ids(
      :`CERTIFICATION_GROUP_ID`
    ),
    id
  );