JSFiddle - React, Tailwind, and code Playground JavaScript var r = /^\+?[1-9][0-9]*$/; //正整数 console.log(r.test(1.23));