validating on keyup

validating on keyup

Hello everybody; I'm trying to validate the text of an input as it is typed.
I have this keyup:

  1. $(".ent").keyup(function(){
  2. $(this).val( $(this).val().replace(/[^0-9\.]/g, "") );
  3. });

The idea is that only let the user type a decimal number; and it does.
The only problem is that it let type a dot [decimal separator I need] at the beginning; and I don't want that :-(
I've been a while and searched Google for the Reg Exp, but had no luck.
If there's someone who actually understands them, please  illuminate me.

Thanks a lot !!!