Decimal or numeric values in regular expression validation

前端 未结 10 1286
礼貌的吻别
礼貌的吻别 2020-11-22 15:09

I am trying to use a regular expression validation to check for only decimal values or numeric values. But user enters numeric value, it don\'t be first digit \"0\"

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 15:47

    Try this code, hope it will help you

    String regex = "(\\d+)(\\.)?(\\d+)?";  for integer and decimal like 232 232.12 
    

提交回复
热议问题