js正则常用的一些东西

mdn的正则文档
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions
js正则表达式的分组匹配
https://www.cnblogs.com/wancheng7/p/8906015.html
js的replace方法
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/replace
js实现家千分位符
https://www.cnblogs.com/lvmylife/p/8287247.html

// 数字加千分位
export function formatThousandSeparator (num) {
    // 整数加千分位
    // const reg = /d{1,3}(?=(d{3})+$)/g;
    // return (num + '').replace(reg, '$&,');

    // 浮点数加千分位
    return (num  + '').replace(/d{1,3}(?=(d{3})+(.d*)?$)/g, '$&,');
}
原文地址:https://www.cnblogs.com/fazero/p/10305149.html