Skip to content

Commit

Permalink
fix: ipv6 addresses with omitted segments aren't matched
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelmay committed Jan 11, 2025
1 parent c04cd2a commit 2b33faa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ip-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2b33faa

Please # to comment.