We can use special selectors in Regular Expressions to select a particular type of value.
One such selector is the digit selector
\d which is used to retrieve one digit (e.g. numbers 0 to 9) in a string.
Appending a plus sign (
+) after the selector, e.g.
/\d+/g, allows this regular expression to match one or more digits.
g is short for 'global', which allows this regular expression to find all matches rather than stop at the first match.
\d selector to select the number of numbers in the string, allowing for the possibility of one or more digit.