Check a string if it resembles an email address.
var isEmail = function(a){return/^[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2,6})$/i.test(a)};
isEmail('[email protected]'); // => true
This regexp was lifted from an early version of the restful authentication Rails plugin, available from https://github.com/technoweenie/restful-authentication and available under a MIT license, Copyright (c) 2009 Rick Olson.
I found this by surfing the examples at 140byt.es. It's possible to shorten your regular expression without changing anything. Simply omit most of the backslashes (not needed inside character classes) and unused brackets.
Please note that this validation (similar to almost all email validations you can find on the web) reject many valid email addresses. For example, it rejects international domain names like tüv.de. I suggest reading this very good article from the Linux Journal: Validate an E-Mail Address with PHP, the Right Way.