Skip to content

matchesUrlPattern

matchesUrlPattern(pattern, candidate): boolean

Defined in: web/url-pattern.ts:43

True when pattern matches candidate in full — always whole-string for a glob (per compileGlob); for a RegExp, by requiring exec’s own match to span the entire candidate (match[0] === candidate) rather than trusting the pattern’s own anchors, so an author who forgets ^/$ fails closed instead of matching a substring. g/y flags are stripped so a shared, stateful RegExp’s lastIndex can’t affect the result.

UrlPattern

string

boolean