Как найти номер в строке JS
// To find a number in a string
const str = "sdfh0d5f6"
const result = str.match(/\d+/g)
console.log(result)
// ['0', '5', '6']
Radmehr Aghdam
// To find a number in a string
const str = "sdfh0d5f6"
const result = str.match(/\d+/g)
console.log(result)
// ['0', '5', '6']
the regular expression on looks for the first number character in the string
let numberInString = theString.match(/\d+/[0];
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.
}