Skip to content

Instantly share code, notes, and snippets.

@tektuitive
tektuitive / validation.js
Created June 26, 2020 23:07
React Native and AWS Amplify Tutorial Docs.
export function validateEmail(email) {
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
return 'Enter a valid email address!';
} else return null;
}
export function validatePassword(password) {
if (
!/(?=(.*[0-9]))((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.{8,}$/i.test(
password,