var str = ‘123,125,236,123,34568‘;
var reg = /^(\d+,?)+$/;
console.log(reg.test(str));
if(reg.test(str)){
console.log("输入合法");
}else{
console.log("输入bu合法");
}
时间: 2024-10-07 06:30:27
var str = ‘123,125,236,123,34568‘;
var reg = /^(\d+,?)+$/;
console.log(reg.test(str));
if(reg.test(str)){
console.log("输入合法");
}else{
console.log("输入bu合法");
}