function Reg (item_decimal) {return '^-?([0-9]' + (item_decimal > 0 ? ('\\.[0-9]{' + item_decimal + '}') : '') + ')$'}
const reg = new RegExp(Reg(3));
console.log(Reg(3))
console.log(reg.test(1.222));
// '^-?([0-9]\.[0-9]{2})$'
// var regexp = new RegExp(`^-?([0-9]+${m > 0 ? `\\.[0-9]{${m}}` : ''})$`)
function Role(item_decimal) {return '只允许输入数字,且须为' + item_decimal + '位小数,不足' + item_decimal + '位,请补0。'}
function Role(item_decimal) {return 'Float number(' + item_decimal + ' decimal places are required)'}
console