📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

GLOB



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 │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Was this page helpful?