目录 数字千分位分割 数字千分位分割 '123456'.replace(/(\d)(?=(\d{3})+$)/g,"$1,") //\d 数字 (?=(\d{3})+$) 匹配,捕获(存储)到分组中 //?= 是正向肯定断言 (\d{3})+ 3的倍数个数字 $ 字符串结尾 //千分位分割 "123,456" '123456.78'.replace(/(\d)(?=(\d{3})+\.)/g, '$1,') //带小数分割 "123,456.78"