the regular expression on looks for the first number character in the string let numberInString = theString.match(/d+/[0];