InRegex Logo
InRegex
New

Match Valid IPv4 URL

Explanation

This regex pattern matches a valid IPv4 address. It validates four sets of numbers separated by periods, each set ranging from 0 to 255.

Javascript

Regular Expression

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
Copy
Do you have Feedback?
Javascript

Example Usage

const regex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
const ipAddress = '192.168.1.1';
console.log(regex.test(ipAddress));
Copy

Test the expression

Similar Regular Expressions