I've been trying to format my inputs to have a space every three characters, up to the period character.
For example:
999999999 => 999 999 999
33333.25 => 33 333.25
222.32 => 222.32
4444 => 4 444
Here is what I have so far:
$(this).on('keyup', function(){
$(this).val( $(this).val().replace(/(\d{3})(?=.)/g, "$1 ") );
});
But this results in this:
999999999 => 999 999 999 OK
33333.25 => 333 33.25 NOT OK
222.32 => 222 .32 NOT OK
4444 => 444 4 NOT OK