Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 2.17 KB

README.md

File metadata and controls

55 lines (42 loc) · 2.17 KB

This Python script is designed to validate an email address based on a set of specific criteria. The purpose of the script is to ensure that the email format conforms to standard rules while also adhering to additional customized validation requirements.

Validation Criteria

  1. Length Check:

    • The email must have a minimum length of 6 characters.
  2. Starting Character:

    • The first character of the email must be an alphabetic letter (a-z or A-Z).
  3. "@" Symbol:

    • The email must contain exactly one "@" symbol.
  4. Domain Validation:

    • The email should end with a valid domain, such as .com, .org, or .net.
    • The script ensures the last 3rd or 4th character from the end is a period (.).
  5. Character Restrictions:

    • Allowed characters: letters (a-z), numbers (0-9), and special characters (_, ., @).
    • Disallowed characters include spaces, uppercase letters, and unsupported special characters.
  6. Error Handling:

    • Each validation step is associated with a specific error message, helping users understand why their input failed the validation.

Workflow

  1. Input:

    • The script prompts the user to enter an email address.
  2. Validation:

    • Sequential checks are performed in the following order:
      1. Length of the email.
      2. Validity of the first character.
      3. Presence and count of the "@" symbol.
      4. Proper domain structure (ending in .xyz, .abc, etc.).
      5. Character-by-character analysis to detect invalid spaces, uppercase letters, or unsupported symbols.
  3. Output:

    • If the email fails any validation step, a corresponding error message is displayed.
    • If the email passes all checks, it is declared valid.

Error Messages

  • "Wrong Email 1": Email is too short.
  • "Wrong Email 2": First character is not a letter.
  • "Wrong Email 3": Missing or multiple @ symbols.
  • "Wrong Email 4": Domain format is invalid.
  • "Wrong Email 5": Contains spaces, uppercase letters, or unsupported characters.

Example Usage

Valid Email:

Invalid Email: