Bug Tracker

Opened 12 years ago

Closed 11 years ago

Last modified 8 years ago

#2674 closed bug (fixed)

[validate] Email regex broken

Reported by: sduggan Owned by: scottgonzalez
Priority: major Milestone: 1.2.3
Component: plugin Version: 1.2.3
Keywords: validate Cc:
Blocked by: Blocking:


The regex to validate an email address seems to be faulty.

It will allow an address with a space on the end, or ending with a . or a . followed by a single character (e.g. "user@…").

Change History (5)

comment:1 Changed 12 years ago by scott.gonzal

Owner: set to scott.gonzalez
Status: newassigned

Can you provide an example of an email address that ends in a space that is being marked valid?

comment:2 Changed 12 years ago by sduggan

"user@… " and "user@…." and "user@…. " all are validated as good email addresses...

This is using validate v 1.2.1 and jQuery 1.2.3. Tested on IE7 and Firefox 2 on Windows, and Safari on Mac. Same behaviour on the demo page at http://jquery.bassistance.de/validate/demo/

comment:3 Changed 12 years ago by scott.gonzal

The trailing space problem is actually caused by the validator trimming all data before passing it to the validation method. This explains why when I tested the validation method by itself I didn't get the same results as you. I'll talk to Jörn about this, the trimming should probably be moved into the validation methods that actually need it. I would expect this to be fixed fairly soon.

As for the other email addresses, I'll try to modify the regex to exclude those cases. They're both technically valid, but we're currently customizing the url and email regexes based on common expectation. These changes will probably take a while. If you need a quick fix, you should be able to create a new validation method that uses the email regex and also tests against /[\.]{2,}$/, this is completely untested, but makes sense in my mind :-)

comment:4 Changed 12 years ago by scott.gonzal

The trimming problem has been fixed [5305].

comment:5 Changed 11 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .

Note: See TracTickets for help on using tickets.