Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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 :: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON 
Javascript :: datatable row color 
Javascript :: your mom is your dad 
Javascript :: github authorization javascript 
Javascript :: Codewars Returning Strings 
Javascript :: colors.xml" already exists! 
Javascript :: js last element of array 
Javascript :: webpack-bundle-analyzer no stats.json file 
Javascript :: js datetime now 
Javascript :: regex to match empty string 
Javascript :: Concatenating variables and strings in React 
Javascript :: how to know which radio button is selected javascript 
Javascript :: nodejs print variable in string 
Javascript :: exit program js 
Javascript :: how to read a firebase txt file 
Javascript :: how to create an anchor tag in javascript 
Javascript :: js object every 
Javascript :: javascript generate a random number between two numbers thats not 1 
Javascript :: js push into array if item exist 
Javascript :: ng serve local network 
Javascript :: jest mock react router params 
Javascript :: fakepath js 
Javascript :: javascript get child by name 
Javascript :: get value of element html js 
Javascript :: directional light three js 
Javascript :: javascript length of number 
Javascript :: jquery append after 
Javascript :: check length of number javascript 
Javascript :: angular 10 get unique values from array of objects 
Javascript :: v-switch vuex store 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =