Javascript浮點數正則表達式

[英]Javascript Floating Point Number Regex Expression


I am looking for a regular expression to match floating point numbers with at most 4 digits before the '.' and at most 4 digits after.

我正在尋找一個正則表達式,以匹配浮點數與'。'前最多4位數。最多4位數。

Examples of valid inputs: 1234.5678 123.567 12.34 1.2 1.23 12.3 etc...

有效輸入的例子:1234.5678 123.567 12.34 1.2 1.23 12.3等......

1 个解决方案

#1


1  

There are many places where you get the answer for it. Here is your required answer,

有很多地方可以得到答案。這是你要求的答案,

^\d{0,4}(\.\d{0,4})?$

Test the answer in this Link

在此鏈接中測試答案


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2016/07/05/73029f25673b0bd5ef05b8e92ced773b.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com