var format = /[!@#$%^&*()_+-=[]{};':"|,.<>/?]+/;
if(format.test(string)){
return true;
} else {
return false;
}
var format = /[ `!@#$%^&*()_+-=[]{};':"|,.<>/?~]/;
// ^ ^
document.write(format.test("My@string-with(some%text)") + "<br/>"); //true
document.write(format.test("My string with spaces") + "<br/>"); //true
document.write(format.test("MyStringContainingNoSpecialChars")); //false
var email = "grepper@gmail.com";
if(email.includes("@")){
console.log("Email is valid");
}
else{
console.log("Email is not valid");
}
// includes return boolean, if your string found => true else => false