regex_count(X;L;Y)
Returns the number of matches of a specified regular expression within a given string.
Syntax
regex_count(X;L;Y)
Input
Argument | Type | Description |
---|---|---|
X |
text | A valid regular
expression to search for in the string Y |
L |
text | A list of one or more string options. (L may be
omitted.)These options include:
The 'tre' and 'pcre' options refer to the
back-end regex engine used for matching. If both options are specified, or if
neither option is specified, the TRE engine will be used.Note: The
'lit' and 'right' options cannot be used in
conjunction with the 'pcre' option. |
Y |
text | The string within which to search for the regular
expression X A scalar value or the name of a column |
Return Value
Returns the integer value corresponding to the number of matches of the regular expression
X
in the string Y
.
If Y
is N/A, the result is 0.
Sample Usage
regex |
options |
string |
regex_count(regex;options;string) |
---|---|---|---|
'a(b|c|d)' | 'Abracadabra' | 3 | |
'a(b|c|d)' | 'icase' | 'Abracadabra' | 4 |
'a(b|c|d)' | '' | 0 |
Additional Information
- 1010data supports POSIX standard regular expressions. See Regular Expressions for more information.