RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find IPV4 and IPV6 address
Expression
^(((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5]))|([\da-fA-F]{1,4}(\:[\da-fA-F]{1,4}){7})|(([\da-fA-F]{1,4}:){0,5}::([\da-fA-F]{1,4}:){0,5}[\da-fA-F]{1,4})$
Description
IPV4 and IPV6 address
Matches
10.11.12.13 | ::1 | fe80::2d3d:3489:63e3:35eb
Non-Matches
3.2.1 | 1::1::1 | 1:2:3:4:5:6:7:8:9
Author Rating: The rating for this expression. bxliu
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: doersn't match these IPv6 addresses
Name: Mark
Date: 3/14/2019 10:26:35 AM
Comment:
'::ffff:255.255.255.255', '64:ff9b::255.255.255.255', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'fe80::1ff:fe23:4567:890a',


Title: doersn't match these IPv6 addresses
Name: Mark
Date: 3/14/2019 10:26:29 AM
Comment:
'::ffff:255.255.255.255', '64:ff9b::255.255.255.255', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'fe80::1ff:fe23:4567:890a',


Title: Does not fully support IPv6 zero compression
Name: Jesse
Date: 2/25/2015 11:07:33 AM
Comment:
"1::" and "::" should match but do not.


Title: wrong match
Name: Thomas
Date: 7/8/2012 7:36:01 AM
Comment:
It also matches this: 88.1.2.442


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials