matchesUrl(url) {
        if (!this.definition.methods.includes('GET')) return false;

        // Transform the route's template into a regex that will match a hydrated URL,
        // by replacing its parameter segments with matchers for parameter values
        const pattern = this.template
            .replace(/[.*+$()[\]]/g, '\\$&')
            .replace(/(\/?){([^}?]*)(\??)}/g, (_, slash, segment, optional) => {
                const regex = `(?<${segment}>${
                    this.wheres[segment]?.replace(/(^\^)|(\$$)/g, '') || '[^/?]+'
                })`;
                return optional ? `(${slash}${regex})?` : `${slash}${regex}`;
            })
            .replace(/^\w+:\/\//, '');

        const [location, query] = url.replace(/^\w+:\/\//, '').split('?');

        const matches =
            new RegExp(`^${pattern}/?$`).exec(location) ??
            new RegExp(`^${pattern}/?$`).exec(decodeURI(location));

        if (matches) {
            for (const k in matches.groups) {
                matches.groups[k] =
                    typeof matches.groups[k] === 'string'
                        ? decodeURIComponent(matches.groups[k])
                        : matches.groups[k];
            }
            return { params: matches.groups, query: parse(query) };
        }

        return false;
    }
Get whether this route's template matches the given URL.

@param {String} url - URL to check.
@return {Object|false} - If this route matches, returns the matched parameters.