Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

string contains at least one number

// String with some numbers
const str = "Hello12345World!";

// Regular expression
const regex = /d/;

// Check if string contians numbers
const doesItHaveNumber = regex.test(str);

console.log(doesItHaveNumber); // true
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #string #number
ADD COMMENT
Topic
Name
3+2 =