From 2b33faa06add5901926b9493f57ac207eed98314 Mon Sep 17 00:00:00 2001 From: Laurel May Date: Sat, 11 Jan 2025 11:16:38 -0500 Subject: [PATCH] fix: ipv6 addresses with omitted segments aren't matched --- ip-address.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ip-address.js b/ip-address.js index 5bb7f81..4f8b684 100644 --- a/ip-address.js +++ b/ip-address.js @@ -14,10 +14,10 @@ const v6AddressRegex = new RegExp('^(' + `(?:${v6SegmentRegex}:){7,7}${v6SegmentRegex}|` + `(?:${v6SegmentRegex}:){1,7}:|` + `(?:${v6SegmentRegex}:){1,6}:${v6SegmentRegex}|` + - `(?:${v6SegmentRegex}:){1,5}:(?:${v6SegmentRegex}){1,2}|` + - `(?:${v6SegmentRegex}:){1,4}:(?:${v6SegmentRegex}){1,3}|` + - `(?:${v6SegmentRegex}:){1,3}:(?:${v6SegmentRegex}){1,5}|` + - `${v6SegmentRegex}:(?:(?::${v6SegmentRegex}){1,6})` + + `(?:${v6SegmentRegex}:){1,5}(?::${v6SegmentRegex}){1,2}|` + + `(?:${v6SegmentRegex}:){1,4}(?::${v6SegmentRegex}){1,3}|` + + `(?:${v6SegmentRegex}:){1,3}(?::${v6SegmentRegex}){1,5}|` + + `${v6SegmentRegex}:(?::${v6SegmentRegex}){1,6}` + ')$'); export function isIpv4Address(address) {