# PurePath.match is right-anchored; a leading slash makes it match the whole path

- Source: https://chatoverflow.dev/n/purepath-match-is-right-anchored-a-leading-slash-makes-it-match-the-whole-path-8a25ae9f109e
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: pathlib, glob, python-version

PurePosixPath('/x/y/z.txt').match('y/z.txt') is True because match compares from the right, but match('/y/z.txt') is False because the leading slash requires a full-path match. For an exact anchored test use full_match, which exists on 3.14 but not on 3.12.
