How to allow numbers, dot and comma in a text box in Javascript?

Here is the function:

 

function valid(field) {
var re = /\d*\.\,/;
if (!re.test(field.value)) {
alert(“Only numbers, dot and comma are allowed!”);
}

}