xxxxxxxxxx
<form action="/phpchecks.php" enctype="multipart/form-data" >
<label for="ema">Email</label>
<input type="text" name="ema" pattern="/^[\w\-\.]*[\w\.]\@[\w\.]*[\w\-\.]+[\w\-]+[\w]\.+[\w]+[\w $]/" ><br><br>
<input type="submit">
</form>
xxxxxxxxxx
^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$
//will validate for: test@gmail.com etc
xxxxxxxxxx
/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
xxxxxxxxxx
// This is by far the best regex used for email
^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
xxxxxxxxxx
# regrex for email for javascript
/^(([^<>()\[\]\\.,;:\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,}))$/
xxxxxxxxxx
const EMAIL_PATTERN =
/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
xxxxxxxxxx
// Author : Mahmmoud Kinawy
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
xxxxxxxxxx
1) js
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
2) using in angular
ng-pattern="mailformat"
xxxxxxxxxx
let regex = new RegExp("([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\"\(\[\]!#-[^-~ \t]|(\\[\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\[[\t -Z^-~]*])");