Regular expressions match floating point number but not integer

后端 未结 2 2049
温柔的废话
温柔的废话 2020-12-06 19:28

I have a problem to define a regexp that matches floating point numbers but do NOT identify integers.

I have the following regular expression, which matches floating

2条回答
  •  独厮守ぢ
    2020-12-06 20:13

    This one should suit your needs:

    [+-]?([0-9]+\.([0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
    

提交回复
热议问题