matchGlob
Whether text matches a glob pattern in full: * matches any run of characters, ? exactly
one. A one-shot shortcut for globToRegExp(pattern).test(text); to test many strings with the
same pattern, build the RegExp once with globToRegExp or createGlobMatcher.
Available since v3.1.10
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pattern | string | The glob pattern |
text | string | The string to test |
options | MatchGlobOptions | Case insensitivity and path globs — see MatchGlobOptions |
Returns
Section titled “Returns”boolean — true if text matches pattern
Examples
Section titled “Examples”Test a name against a glob
Section titled “Test a name against a glob”One call, with an option to ignore case.
Related Types
Section titled “Related Types”MatchGlobOptions
Section titled “MatchGlobOptions”Options for matchGlob and parsePatternOrRegExp.
