Javascript function need allow numbers, dot and comma

前端 未结 6 1958
悲&欢浪女
悲&欢浪女 2020-12-09 04:30

I need to create a function to allow numbers dot and comma. So anyone corrects the following function

function on(evt) {
  var theEvent = evt || window.event         


        
6条回答
  •  星月不相逢
    2020-12-09 05:12

    The Regex that I made for numbers following format of COMMA9.2

    Example

    1. 1,350.88
    2. 120.00
    3. 1,500,999.24
    4. 100
    5. 10000000

    RegEx

    ^(\d+|\d{1,3},\d{3}|\d{1,3},\d{3},\d{3}|\d{1,3}(,\d{3})*|\d{1,3}(,\d{3})*\.\d+)$

提交回复
热议问题