bradxr
8/4/2018 - 7:42 PM

Match All Numbers

Shortcut to look for just numbers - \d Equal to the character class [0-9]

let numString = "Your sandwich will be $5.00";
let numRegex = /\d/g;
console.log(numString.match(numRegex));   // [5, 0, 0]