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