Skip to content

Instantly share code, notes, and snippets.

View wolftrax5's full-sized avatar
🏠
Working from home

Alejandro Medina wolftrax5

🏠
Working from home
View GitHub Profile
@wolftrax5
wolftrax5 / is-valid-email.ts
Created May 9, 2022 13:52 — forked from Klerith/is-valid-email.ts
Email validation - customHook
const isValidEmail = ( email: string ) => {
const 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,}))$/;
return re.test(email);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<textarea name="text" id="text" cols="30" rows="10"></textarea>
<button id="button">Convert</button>