# GLOB

> GLOB function in StackQL: case-sensitive Unix-style wildcard matching of a string against a pattern.

Source: https://stackql.io/language-spec/functions/string/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 `]](/language-spec/select) [[` REGEXP_LIKE `]](/language-spec/functions/re/regexp_like) [[` INSTR `]](/language-spec/functions/string/instr)

* * * 

## Syntax

```sql
SELECT GLOB(pattern, string) FROM <multipartIdentifier>;
```

## Arguments

__*pattern*__  
The wildcard pattern.

__*string*__  
The string tested against the pattern.

> The operator form `string GLOB pattern` is 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:

```sql
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-`:

```sql
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](https://www.sqlite.org/lang_corefunc.html#glob)
