LIKE()
All functions > COMPARISON > LIKE()
Returns TRUE if a string matches a specified pattern with wildcards.
Signatures
Returns: TRUE if the string matches, FALSE if not, NULL if an input is NULL
LIKE(expr1: VARCHAR, expr2: VARCHAR, [escape: VARCHAR]) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr1 | VARCHAR | Yes | String to match |
expr2 | VARCHAR | Yes | Pattern (% and _ wildcards) |
escape | VARCHAR | No | Escape character for wildcards |
Notes
- Wildcard pattern matching
%matches zero or more characters_matches exactly one character- Case-sensitive matching
- NULL inputs return NULL
- An escape character can treat
%and_literally (default escape is backslash in the lowering template)
Related operators
Examples
LIKE — functional call
FeatureQL
SELECT
f1 := LIKE('ab', 'a%') -- `LIKE(expr, pattern)` matches keyword `LIKE`
;Result
| f1 BOOLEAN |
|---|
| true |
LIKE — chained
FeatureQL
SELECT
f1 := ('ab').LIKE('a%') -- Receiver is the string; argument is the pattern
;Result
| f1 BOOLEAN |
|---|
| true |