Answers for "how to find number in string js"

2

how to find number in string js

// To find a number in a string
const str = "sdfh0d5f6"
const result = str.match(/\d+/g)

console.log(result)
// ['0', '5', '6']
Posted by: Guest on May-07-2022
1

javascript find number in string

the regular expression on looks for the first number character in the string

let numberInString = theString.match(/\d+/[0];
Posted by: Guest on November-27-2021

Code answers related to "how to find number in string js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language