Regex for optional comma separated number with decimal point

前端 未结 1 1774
旧时难觅i
旧时难觅i 2021-01-06 23:35

I\'m after a regular expression which will match the following

1,245.30
24,235,235.50
12235235.60
235.50

The decimal is mandatory but I\'d

相关标签:
1条回答
  • 2021-01-07 00:06

    Um, just allow a number without commas as an explicit alternative:

    ^(\d?\d?\d(,\d\d\d)*|\d+)(\.\d\d)?$
    
    0 讨论(0)
提交回复
热议问题