Bug Tracker

Modify

Ticket #2674 (closed bug: fixed)

Opened 5 years ago

Last modified 15 months ago

[validate] Email regex broken

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

Description

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

comment:1 Changed 5 years ago by scott.gonzal

  • Owner set to scott.gonzalez
  • Status changed from new to assigned

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

comment:2 Changed 5 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 5 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 5 years ago by scott.gonzal

The trimming problem has been fixed [5305].

comment:5 Changed 4 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed

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 .

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.