// IPipReg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;// PORTportReg = /^([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/;if(ipReg.test(data.ip) != true){ ?UserNotification.error("请检查 IP 格式是否正确!"); }if(portReg.test(data.port) != true){ ?UserNotification.error("请检查 PORT 格式是否正确!");}
nodejs中正则
原文地址:https://www.cnblogs.com/stellar/p/10785000.html