# Regex syntax ## Function Explains the basic BT regular-expression syntax: create a Regex object with `regex(pattern, flags)`, then call `test`, `match`, or `replace`, or pass it to `String.search`, `String.match`, or `String.replace`. ## Syntax ```bt regex(pattern, flags) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | pattern | String | No | '' | Regular body. | | flags | String | No | '' | Flags string. | ## Return value | Type | Description | | ------ | ------ | | Regex | Returns a Regex object. | ## Example ```bt rule = regex('^BT$', '') result = rule.test('BT') // Output: true print result ``` ## Notes -Uses Rust regex engine under the hood. - A Chinese error will be thrown when regular compilation fails.