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.
const regex = /\b(?:\d{1,3}\.){3}\d{1,3}\b/;
const ipAddress = '96.0.0.1';
console.log(ipAddress.match(regex));
Copiar