There are any numbers, how to start with finding all zeros using a regular expression?
For example, such a number is 0.001 .
Regular expression:. .[0].* , But one is selected.
There are any numbers, how to start with finding all zeros using a regular expression?
For example, such a number is 0.001 .
Regular expression:. .[0].* , But one is selected.
Well, if I understand the question correctly ...
var x = 0.001 var s = x + '' console.log(s.replace(/\.0+/, '.')) (?<=(?<=\d)\.)[0]{1,} - LLENN 2:22 pmOption to delete zeros after a point before the first meeting of the digit (except zero)
var string = '0.001'; console.log(string.replace(/(?<=\.)[0]+/, '')); Option to remove absolutely all zeros after the decimal point.
var string = '0.001337014880'; console.log(string.replace(/(?!^0)(?<=\.?)[0]+/g, '')); 100.001 . 2. Why shove a preview back to where it is not needed? Moreover, it is still supported in few places. - Qwertiy ♦Source: https://ru.stackoverflow.com/questions/852653/
All Articles
0.1? - Wiktor Stribiżew