const regex = new RegExp('\\b(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\b', 'g')
const str = `67.93.195.181
248.83.55.126
277.92.425.12
220.164.237.203
36.173.112.111
36.33.171.246
37.123.14.323
23.93.163.86
236.129.173.89
2.224.237.202
256.123.123.123
69.10.174.79
35.185.155.175
6.215.157.157
123.123.123.234
188.43.121.96
101.22.3.71
1.1.1.1
55.58.142.177
179.107.91.118`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions