匹配IP地址
function judge(str) { if(str.length < 7 || str.length > 15) { return false } var arr = str.split('.') len = arr.length for (var i=0; i<len; i++) { if(isNaN(arr[i])) { return false } if (arr[i] <0 ||arr[i] >255) { return false } } return true } console.log(judge('1.2.3.5'))