var txt = "kdsjfksd 23.23.232.23 0.0.0.0 weriueru3454k.34534.er34.234 2342.234.342.234.2 23423423k234qwe.qweq.we.qwe.q.34.243.2.wqrw 234.234.234w.r.wq.r34.23. 1.423.342.23 23.22.123.23 A.......";
var data = txt.split(" "); //assuming we have space separated data
var ip = null;
console.clear();
for (i = 0; i < data.length; i++) {
//console.log(data[i])
ip = null;
ip = data[i].split("."); //should contain 4 items to qualify
//console.log(ip);
if (ip.length == 4) {
var f = false;
for (d = 0; d < ip.length; d++) {
//console.log(ip[d]);
if (!isNaN(ip[d]) && (ip[d] >= 0 && ip[d] <= 255)) {
continue;
} else {
f = true;
break;
}
}
if (!f) {
console.log(data[i]);
}
}
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.