Skip to main content

Module glob

Module glob 

Source
Expand description

Redis’s glob matching, which is what KEYS, SCAN MATCH, CONFIG GET and COMMAND LIST FILTERBY PATTERN all mean by a pattern.

It is not a regular expression and it is not the shell’s glob either. There are four things in it: * for any run of bytes, ? for one byte, [...] for a class, and a backslash for the byte after it. Everything else is a literal, including the bytes that are special in a regular expression, so user.* matches user.1 and does not match userX1.

Bytes rather than characters, the same as Redis. A pattern is matched against a key, a key is arbitrary bytes, and deciding what a character is would mean deciding what encoding a key is in, which nobody can do.

Functions§

matches
Whether text matches pattern.
matches_nocase
Whether text matches pattern, optionally ignoring ASCII case.