# Regex grouping and flags ## Function Describes grouping, capturing, and capturing group return rules for String.match. ## Syntax ```bt regex(pattern, flags) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | pattern | String | No | '' | Can contain (...) capture groups. | | flags | String | No | '' | Regular flags. | ## Return value | Type | Description | | ------ | ------ | | Regex | Returns a Regex object. | ## Example ```bt result = 'BT-2026'.match(regex('^([A-Z]+)-([0-9]+)$', '')) // Output: ["BT-2026","BT","2026"] print result ``` ## Notes - When String.match receives a Regex without g, item 0 is a complete match and subsequent items are capturing groups.