get only the number in the string javascript code example
Example: javascript find a digit in str
var regex = /\d+/g;
var string = "Any string you want!";
var matches = string.match(regex); // creates array from matches
if (matches){
// There is a digit in the string.
} else {
// No Digits found in the string.
}