Keith Watanabe * NET 2.0

Email Validation Regular Expression
By: Keith Watanabe
Published On: 5-1-2004

Here's a quickie for validating email in javascript and php (note: i added lines to make it more readable than copy-and-pastable) javascript: var email_exp = /^(([^<>()[\]\\.,;:\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,}))$/; php: if (eregi("^[_a-z0-9-] +(\.[_a-z0-9-]+)*@[a-z0-9-]+ (\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { *DO_SOMETHING* }

Tags: php
AddThis Social Bookmark Button Sphere: Related Content

Trackbacks: (Trackback URL)

No Comments Posted Yet
October [November] December
Sun Mon Tue Wed Thu Fri Sat
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6