Welcome aboard! We are happy you are here and wish you good net-raft!
function isnumber(mystring:string) {
var matches = mystring.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)
if (matches != null) {
console.log("it is ok!");
} else {
console.log("Please type numeric and alphabetic characters!");
}
}
var str = new isnumber("I am 31 years old!");
<!DOCTYPE html>
<html>
<head>
<script type="text/typescript" src="/typescript/DssZIPNwFf201944183.ts"></script>
<script src="https://rawgit.com/Microsoft/TypeScript/master/lib/typescriptServices.js"></script>
<script src="https://rawgit.com/basarat/typescript-script/master/transpiler.js"></script>
</head>
<body>
</body>
</html>
// /typescript/DssZIPNwFf201944183.ts
var str:String = "I love typescript!"
if (str.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)) {
document.body.innerHTML = `<div>${"it is ok"}</div>`
}
else
{
document.body.innerHTML = `<div>${"Please type numeric and alphabetic characters"}</div>`
}
var re = /javascript/gi;
var str = "I love javascript";
if (str.search(re) == -1 ) {
console.log("Does not contain javascript" );
} else {
console.log("Contains javascript" );
}
The most helpful TYPESCRIPT solutions