Posted 548 days ago
Wrote a quick function today also to verify that the syntax of an email address is valid, using regular expressions.
^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$
This will match a userid containing letters, numbers, underscores, dots and hyphens, followed by an at sign, then a domain name containing letters, numbers, hyphens and dots, followed by a suffix of 2-to-4 characters.
Using this regex, I can ensure that the user has entered a potentially valid email address before attempting to send out a confirmation email.
add to
del.icio.us