like¶
Description¶
Returns true if subject matches pattern (case-sensitive).
Within pattern, escape can be included to denote that the character following it be interpreted literally.
The arguments pattern and escape must be string literals. The argument pattern may include wildcards _ (matches exactly one character) and % (matches zero or more characters). If included, escape may only be a single character. If using backslash as the escape character, it must be escaped in the escape clause (see example).
Return type¶
bool
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
like(subject, pattern, [ escape ])
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
subject |
string |
no |
no |
none |
pattern |
string |
no |
no |
constant |
escape |
string |
yes |
no |
constant |
Examples¶
filter like(@.bundle_kind, "%kube%")
Pass through all bundle kinds that contain the string ‘kube’.
filter like(@.bundle_kind, "k^%__", "^")
Pass through all bundle kinds that are 4 characters long and begin with ‘k%’.
filter like(@.bundle_kind, "k\\%__", "\\")
Pass through all bundle kinds that are 4 characters long and begin with ‘k%’.