Sentinel Regex Support

Hi,

I am attempting to search attributes using regex. Is there a way to do this in Sentinel? I don’t mean the boolean response you get with ‘matches’ or ‘not matches’, I mean a list of strings (or some such) returned of the actual values, similar to Terraform’s ‘regex’ function.

Thanks,
Tom

Hey Tom-

There’s not a direct analogue, but you can use a function in combination with matches to produce the desired result via filter or map by checking your enumerable against matches, for example:

get_specific_foods = func(list_of_foods, food_search_term){
  return filter list_of_foods as food {food matches food_search_term}
}

Here is the full snippet:

https://play.sentinelproject.io/p/RrHrQxNzU6f

And here is the documentation on Sentinel’s collection operations:

@tp_hc