regex to match number comma number

后端 未结 3 1059
有刺的猬
有刺的猬 2021-01-20 16:46

This is what I have right now:

^[0-9]([,][0-9])?$

My problem is that i want to be able add more than one digit before and after my comma. <

3条回答
  •  误落风尘
    2021-01-20 17:15

    Use + sign, and also remove [] brackets around ,(they are not neccessary):

    ^[0-9]+(,[0-9]+)?$
      //  ^-------^---------here they are
    

提交回复
热议问题