Skip to content

doc: document URLPattern instance getters - #65804

Open
charpeni wants to merge 1 commit into
nodejs:mainfrom
charpeni:doc/url-document-urlpattern-getters
Open

doc: document URLPattern instance getters#65804
charpeni wants to merge 1 commit into
nodejs:mainfrom
charpeni:doc/url-document-urlpattern-getters

Conversation

@charpeni

@charpeni charpeni commented Sep 5, 2026

Copy link
Copy Markdown

URLPattern instances expose the protocol, username, password, hostname, port, pathname, search and hash getters, which return the pattern string of each component, and the hasRegExpGroups getter. They are implemented in src/node_url_pattern.cc, were part of the initial URLPattern implementation that shipped in v23.8.0, and are defined by the URL Pattern Standard, but doc/api/url.md never documented them.

This adds one subsection per getter to the URLPattern class section, placed before exec() and test() to mirror the layout of the URL class, each with the added: v23.8.0 metadata and a short example.

Every example output was verified by running the example code on v24.19.0.

Note

Disclosure per the AI use policy: Claude Fable 5.1 (Anthropic), running in Claude Code, was used to audit this page and draft the change. I reviewed the diff and verified the output myself, and I will handle review feedback personally.

Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-hasregexpgroups

`URLPattern` instances expose the `protocol`, `username`, `password`,
`hostname`, `port`, `pathname`, `search` and `hash` getters, which return
the pattern string of each component, and the `hasRegExpGroups` getter.
They have been available since the initial implementation but were never
documented.

Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-protocol
Refs: https://urlpattern.spec.whatwg.org/#dom-urlpattern-hasregexpgroups
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. url Issues and PRs related to the legacy built-in url module. labels Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

@charpeni charpeni changed the title doc: document URLPattern instance getters doc: document URLPattern instance getters Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to Node.js documentation. url Issues and PRs related to the legacy built-in url module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants