v.21.11New Features

New functions mapContainsKeyLike and mapExtractKeyLike for regex operations in maps

New function mapContainsKeyLike to get the map that key matches a simple regular expression. #29471 (凌涛). New function mapExtractKeyLike to get the map only kept elements matched specified pattern. #30793 (凌涛).
Introduces two new functions, mapContainsKeyLike and mapExtractKeyLike, to filter and extract map elements based on simple regular expression patterns matching the map keys.

Why it matters

These functions enable users to efficiently query map data structures by matching keys with a pattern, allowing for selective retrieval and existence checks of map elements that satisfy the specified key pattern. This enhances flexibility and expressiveness when working with complex map data.

How to use it

Use mapContainsKeyLike(map, pattern) to check if any key in the map matches the given simple regular expression pattern. Use mapExtractKeyLike(map, pattern) to return a new map containing only the key-value pairs where the key matches the specified pattern.