複製程式碼 程式碼如下: function format🎜>function if(!/^( |-)?(d )(.d )?$/.test(num)){alert("wrong!"); return num;} var a = var a = = RegExp.$2, c = RegExp.$3; var re = 新 .test(b)) b = b.replace(re, "$1,$2$3"); return a "" }