Skip to main content

Bug Tracker

Side navigation

#2674 closed bug (fixed)

Opened April 10, 2008 02:40PM UTC

Closed October 12, 2009 11:19PM UTC

Last modified March 15, 2012 08:24PM UTC

[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@example.x").

Attachments (0)
Change History (5)

Changed April 10, 2008 03:11PM UTC by scott.gonzal comment:1

owner: → scott.gonzalez
status: newassigned

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

Changed April 10, 2008 10:39PM UTC by sduggan comment:2

" " and "" and " " 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

Changed April 16, 2008 05:38PM UTC by scott.gonzal comment:3

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 :-)

Changed April 24, 2008 04:59PM UTC by scott.gonzal comment:4

The trimming problem has been fixed [5305].

Changed October 12, 2009 11:19PM UTC by dmethvin comment:5

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, .