GLOB
Tests whether a string matches a pattern with Unix file name wildcards. Matching is case sensitive: * matches any sequence of characters, ? matches one character, and [...] matches one character from a set.
See also:
[SELECT] [REGEXP_LIKE] [INSTR]
Syntax
SELECT GLOB(pattern, string) FROM <multipartIdentifier>;
Arguments
pattern
The wildcard pattern.
string
The string tested against the pattern.
The operator form
string GLOB patternis not accepted by the StackQL parser; use the function form.
Return Value(s)
Returns a true value when string matches pattern, otherwise a false value: 1 or 0 in a query without a provider relation, true or false when evaluated over provider rows. Use it as a condition rather than comparing the result with a number.
Examples
Case-sensitive matching
The second pattern does not match because GLOB compares case:
SELECT GLOB('*.io', 'stackql.io') AS a, GLOB('*.IO', 'stackql.io') AS b;
|---|---|
| a | b |
|---|---|
| 1 | 0 |
|---|---|
Filter rows by a name pattern
The following query returns the repositories in a GitHub organization whose names start with docusaurus-plugin-:
SELECT name
FROM github.repos.repos
WHERE org = 'stackql-labs'
AND GLOB('docusaurus-plugin-*', name);
For more information, see https://www.sqlite.org/lang_corefunc.html#glob