Okay, I’m needing some help with a regular expression replace in javascript.
I have this function which takes everying out but numbers.. but I need to allow commas as well.
function validDigits(n){
return n.replace(/\D+/g, '');}
I’m still pretty cloudy on regex syntax, so if anyone could help me out I would greatly appreciate it.
When you use square brackets and a ^ after the open bracket you search for every character that is not one of those between brackets, so if you use this method and search for everything that is not a number or a comma it should work well.