InRegex Logo
InRegex
New

Match Valid IPv6 URL in Javascript

Explanation

This regex pattern matches a valid IPv6 URL. It consists of 8 groups of 1 to 4 hexadecimal characters separated by colons.

Javascript

Regular Expression

/^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/
Copy
Do you have Feedback?
Javascript

Example Usage

const regex = /^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/;
const ipv6URL = '2001:0db8:85a3:0000:0000:8a2e:0370:7334';
if(regex.test(ipv6URL)) {
    console.log('Valid IPv6 URL');
}
Copy

Test the expression

Similar Regular Expressions