react check if string is mail
let handleOnChange = ( email ) => {
// don't remember from where i copied this code, but this works.
let re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if ( re.test(email) ) {
// this is a valid email address
// call setState({email: email}) to update the email
// or update the data in redux store.
}
else {
// invalid email, maybe show an error to the user.
}
}
Also in JavaScript:
- sum of an array
- blank catch js
- number is even or odd fucntion in javascript
- set and get array inside cookie in javascript
- discord.js find word inside comment
- trigger play video jquery
- javascript uppercase first letter of each word
- javascript split array into chunks
- console.log('qqqqqqqqqqqqqqqqqqqq'); jslint error how to fix
- how to get property names from object using map method react
- how to use javascript to get full file path
- intval js
- Error: Cannot find module 'ejs'
- js change video src
- how to push string into array in javascript
- js is variable int
- angular routing url params
- random image and link js
- loopback model count
- javascript array exists check
- ejs-multiselect
- math random equitative js
- js check if obj all false
- factorial function javascript