Help us shape the future of Go! Take the 2026 Go Developer Survey

glob

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package glob implements Redis-style glob matching used by KEYS, SCAN MATCH and PSUBSCRIBE.

Supported syntax:

  • matches any sequence of characters (including none) ? matches exactly one character [abc] matches one character from the set [^ab] matches one character not in the set [a-z] matches one character in the range \x matches x literally

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLiteral

func IsLiteral(pattern string) bool

IsLiteral reports whether pattern contains no glob metacharacters, in which case callers can do an exact lookup instead of a scan.

func Match

func Match(pattern, s string) bool

Match reports whether s matches the glob pattern. It runs in O(len(pattern) * len(s)) time: on a mismatch it only backtracks to the most recent '*', so hostile patterns like "*a*a*a*...b" cannot cause exponential work.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL