数字转化金额正则

<InputNumber
    style={{ width: '26%' }}
    min={0}
    step={1}
    max={100000}
    formatter={value => `¥ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
    parser={value => (value ? value.replace(/¥\s?|(,*)/g, '') : '')}
/>

正则:

`¥ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
posted @ 2020-09-17 16:16  文学少女  阅读(212)  评论(0编辑  收藏  举报