InRegex Logo
InRegex

Match IP Address in JavaScript

Explication

This regex pattern matches an IP address in the format 'xxx.xxx.xxx.xxx', where each 'xxx' can be a number between 0 and 255. The '\b' ensures that the match is a whole word.

javascript

Expression Régulière

\b(?:\d{1,3}\.){3}\d{1,3}\b
Copier
Avez-vous des Retours ?
javascript

Exemple d'Utilisation

const regex = /\b(?:\d{1,3}\.){3}\d{1,3}\b/;
const ipAddress = '96.0.0.1';
console.log(ipAddress.match(regex));
Copier

Expressions Régulières Similaires