regexp_count1
Counts the number of substrings matching the specified pattern in source, starting from the start_position.
Syntax
regexp_count1(string <source>, string <pattern>[, bigint <start_position>])
Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| source | Yes | STRING | The string to be searched. |
| pattern | Yes | STRING | The regular expression. An error is returned if pattern is an empty string. |
| start_position | No | BIGINT | The starting position for the search. Must be greater than 0. When not specified, the default is 1, meaning the match starts from the first character of source. |
Return Values
Returns a value of type BIGINT.
- If no match is found, 0 is returned.
- If source or pattern is NULL, NULL is returned.
Example Code
Returns 4.
select regexp_count1('ab0a1a2b3c', '[0-9]'); Returns 3.
select regexp_count1('ab0a1a2b3c', '[0-9]', 4); Returns NULL.
select regexp_count1('ab0a1a2b3c', null); What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot