Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check for special characters in javascript

var format = /[!@#$%^&*()_+-=[]{};':"|,.<>/?]+/;

if(format.test(string)){
  return true;
} else {
  return false;
}
Comment

regex to check if string contains special characters javascript

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
Comment

javascript check if string contains special characters

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: js loader 
Javascript :: MongoDb user find 
Javascript :: js stairs algorithm 
Javascript :: live vue js port number 
Javascript :: array of images javascript 
Javascript :: send mail, nodemailer, nodemailer, mailer, nodemailer npm 
Javascript :: jquery get 2 hours frmo now 
Javascript :: async await javascript stack overflow 
Javascript :: how to unselect input javascript 
Javascript :: how to insert html into javascript 
Javascript :: get element by xpath 
Javascript :: determine if touch screen js 
Javascript :: how to display array values in javascript 
Javascript :: mongodb replace root 
Javascript :: Send Post Fetch REquest With Django 
Javascript :: jsonwebtoken error with react js 
Javascript :: JavaScript Number() Function 
Javascript :: dockerfile 
Javascript :: jquery datatime 
Javascript :: javascript get nested element 
Javascript :: xmlhttprequest js 
Javascript :: lpad javascript 
Javascript :: axios cnd 
Javascript :: remove duplicate value from string 
Javascript :: react pass parameters to other page 
Javascript :: javascript time script 
Javascript :: open in a new tab react 
Javascript :: debounce 
Javascript :: how to remove last index of array in javascript 
Javascript :: javascript get image dimensions 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =