More Geek Speak

Just as a way of remembering – for me – here is the way to do a nice regex e-mail check in PHP:

// validate name

if (eregi("^([a-zA-Z0-9])+([.a-zA-Z0-9_-])+
@([a-zA-Z0-9_-])+\.([a-zA-Z]{2,4})$",
$email)) {
$message = "valid e-mail";
}
else {
$message = "INVALID e-mail";
}

This is slightly different from the Perl version I’ve posted earlier; mainly, have to drop the backslash before the allowable dot (.) in the e-mail prefix (before the @ sign). And – duh! – it’s written in PHP lingo, not Perl. Concept pretty much exactly the same, however.