Skip to content

PurePath.match() method

pathlib-ts > PurePath > match

Checks whether the path matches a non-recursive glob pattern.

Signature:

match(pattern: PathLike, options?: {
caseSensitive?: boolean;
}): boolean;

Parameter

Type

Description

pattern

PathLike

Pattern to evaluate. Recursive wildcards are treated like *.

options

{ caseSensitive?: boolean; }

(Optional) Optional case sensitivity override.

Returns:

boolean

true when the suffix of the path satisfies the pattern.

Relative patterns are matched from the right-hand side; recursive ** is not supported, mirroring CPython. Use PurePath.fullMatch() when you need to inspect the entire path.