Description | The |
Syntax | REGEX_SEARCH( |
Output | integer |
Variables
text
: The input text string in which you want to search for a matching substring.pattern
: The regular expression pattern to search for within the text.offset: (Optional) An offset (number greater than 0) that specifies the occurrence of the matching substring to return. The default is usually the first occurrence (offset 1).
When the REGEX_SEARCH()
function returns -1, it indicates that there is no matching occurrence of the specified regular expression pattern or offset within the given text.
For example, if a user is looking for specific data and REGEX_SEARCH()
function returns -1, they might conclude that the desired data is not present in the document.
Example
REGEX_SEARCH(`Text`, "[+]?[0-9]?[-. ]?\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}")
ID | Text | REGEX_SEARCH |
1 | Contact us at (555) 555-1234 for support. | 14 |
2 | Please call 1-800-123-4567 for inquiries. | 13 |
3 | No phone number in this text. | −1 |