# Regex character class ## Function Explain how to write character classes and range matching. ## Syntax ```bt regex(pattern, flags) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | pattern | String | No | '' | Can contain character classes such as [abc], [a-z], [^0-9], etc. | | flags | String | No | '' | Regular flags. | ## Return value | Type | Description | | ------ | ------ | | Regex | Returns a Regex object. | ## Example ```bt rule = regex('^[a-z]+$', 'i') result = rule.test('BT') // Output: true print result ``` ## Notes - Whether the character range is case-sensitive or not is determined by the i flag.