Open timonson opened 1 year ago
Regarding the first example in the section
Starts with
^
will only match if used at the start of the protocol portion of the URLPattern and is redundant if used.
But following works
let pattern = new URLPattern({ pathname: "(^/ba)" });
console.log(pattern.test("http:/exb.com/ba"));
// true
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API#regex_matchers_limitations
What specific section or headline is this issue about?
Lookaheads, and lookbehinds will never match any portion of the URLPattern.
What information was incorrect, unhelpful, or incomplete?
All lookaheads and lookbehinds examples are wrong. Let's take a look at the negative-lookahead examples:
There are two problems in the docs:
/
a
If you instead did,/(a(?!b).*)
it would match correctly and returntrue
in the secondpattern.test
.What did you expect to see?
Do you have any supporting links, references, or citations?
https://www.regular-expressions.info/lookaround.html
Do you have anything more you want to share?
No response