IP地址

if (!/^(d{1,2}|1dd|2[0-4]d|25[0-5])(.(d{1,2}|1dd|2[0-4]d|25[0-5])){3}$/.test($.trim($('#addIPAddress').val()))) {
                        alert('IP地址格式不正确,请重新输入!');
                        $('#addIPAddress').focus();
                    }

原文地址:https://www.cnblogs.com/whlhaikuotiankong/p/3401957.html