Rewrite input value

Rewrite input value

Hi,

How can I directly rewrite the input value when a users enters text in an input field ?

I am looking to rewrite a field called size. When the users enters 1M it should become 1.000.000
When the user enters 500K it should become 500.000, 1K should be become 1.000 etc..

thanks for your help!