InRegex Logo
InRegex
Neu

Find IPv4 in Javascript

Erklärung

This regex pattern matches IPv4 addresses. It looks for sequences of 1 to 3 digits followed by a period, repeated three times, and ending with another sequence of 1 to 3 digits. The \b ensures that it matches the whole IPv4 address and doesn't capture partial matches within longer strings.

Javascript

Regulärer Ausdruck

\b(?:\d{1,3}\.){3}\d{1,3}\b
Kopieren
Haben Sie Feedback?
Javascript

Beispielverwendung

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

Testen Sie den Ausdruck

Ähnliche Reguläre Ausdrücke