Skip to content

How to write pattern to match LAN addresses? (192.168.*) #258

Answered by jeremyroman
Ayuilos asked this question in Q&A

You must be logged in to vote

Yeah, I think this is an issue with how we currently canonicalize hostname parts. It might be one we're able to resolve if nobody is yet depending on the current behavior. I made a note of it in an issue comment somewhere, but it might not have its own separate issue, so filing one would be a good idea.

This can be worked around (at least, in contexts where you aren't restricted to patterns which do not have regexp groups, by using that to avoid canonicalization:

new URLPattern({protocol: 'http', hostname: '(192\\.168).*'})
new URLPattern('http://(192\\.168).*:*')

Replies: 1 comment 2 replies

You must be logged in to vote
2 replies
@jeremyroman

@Ayuilos

Answer selected by Ayuilos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants