啊code
var v='aa' var re =new RegExp("^\\d+" + v + "$","gim"); re爲: /^\d+aa$/gim var re =new RegExp("^\\d+" + v + "$","gim"); // re爲/^\d+bl$/gim
var decimalLen =1 var re = new RegExp("^((0(\\.[0-9]{0," + decimalLen +"})?)|([1-9][0-9]*(\\.[0-9]{0,"+ decimalLen + "})?))$","g");
undefined var re2 = /^((0(.[0-9]{0,1})?)|([1-9][0-9](.[0-9]{0,1})?))$/g undefined re /^((0(.[0-9]{0,1})?)|([1-9][0-9](.[0-9]{0,1})?))$/g re2 /^((0(.[0-9]{0,1})?)|([1-9][0-9]*(.[0-9]{0,1})?))$/gci