Skip to main content

GLOB

Introduced or updated: v1.2.714

Performs case-sensitive pattern matching using wildcard characters:

  • ? matches any single character.
  • * matches zero or more characters.

Syntax

GLOB(<string>, <pattern>)

Return Type

Returns BOOLEAN: true if the input string matches the pattern, false otherwise.

Examples

SELECT
GLOB('abc', 'a?c'),
GLOB('abc', 'a*d'),
GLOB('abc', 'abc'),
GLOB('abc', 'abcd'),
GLOB('abcdef', 'a?c*'),
GLOB('hello', 'h*l');;

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ glob('abc', 'a?c') │ glob('abc', 'a*d') │ glob('abc', 'abc') │ glob('abc', 'abcd') │ glob('abcdef', 'a?c*') │ glob('hello', 'h*l')
├────────────────────┼────────────────────┼────────────────────┼─────────────────────┼────────────────────────┼──────────────────────┤
truefalsetruefalsetruefalse
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today