EasyRegex Logo
EasyRegex
Nouveau

Match IP Address in JavaScript

Javascript

Expression Régulière

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

Explication

This regex pattern matches an IP address by looking for 4 groups of 1 to 3 digits separated by periods. The \b ensures that it matches whole words only.

Javascript

Exemple d'Utilisation

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

Expressions Régulières Similaires