判断输入的数是否是正整数

536 阅读1分钟
   //正整数和0
  let reg0 = /^([1-9]\d*|[0]{1,1})$/
  //正整数
  let reg=/^[1-9]\d*$/