Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-449

Leading and trailing spaces in EmailValidator should not be valid

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7
    • Component/s: Routines
    • Labels:
      None

      Description

      I feel that:
      EmailValidator.getInstance(true).isValid(" some@email.com ");
      should return false, but the regex used in EmailValidator matches this string. Furthermore, the following user + domain validation is done only on "some" and "email.com", respectively. This is because the regex captures the user and domain without the space.

      I know the documentation states : "This implementation is not guaranteed to catch all possible errors in an email address" but, I think this case is simple enough to be in the validator.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fboutin Frederic Boutin
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: