It's a) fragile (every time a tld is added, you've got to go change your regex) b) allows invalid addresses (underscores in the domain name), and c) excludes valid email addresses (e.g. the '+' character in the local part of the address is legal).
As another example, you left out .asia, .biz, .jobs (apple must love this one!), .mobi, .... http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains If you *must* validate in javascript, you're better off with a looser script. The only solid way of validating is to send the user an email, and have them respond (click a link, etc.) TAG See also: en.wikipedia.org/wiki/E-mail_address http://uphpu.org/pipermail/uphpu/2005-December/004221.html On Jul 3, 2007, at 12:17 PM, Diodeus wrote: > > I do it with this plain-old Javascript: > > var emailRe = /^\w+([\.-]?\w+)[EMAIL > PROTECTED]([\.-]?\w+)*\.(\w{2}|(com|net|org| > edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/ > if(!emailRe.test(document.F1.email.value)) { > alert("Bad Email") > } > > > On Jun 30, 7:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> How to validating email with Ajax and Prototype Library? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
