# String.search ## Function Finds the first occurrence of a string or regular expression in the current string. ## Syntax ```bt string.search(pattern) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | pattern | String/Regex | No | '' | The string or regular expression to find. | ## Return value | Type | Description | | ------ | ------ | | Int | Returns the starting byte position if found; returns -1 if not found. | ## Example ```bt text = 'hello BT' result = text.search('BT') // Output: 6 print result ``` ## Notes - The return value is calculated as a UTF-8 byte offset.