Validation Rules
These are the validation rules which my program follows. These rules were created with careful research.
- Total length must be between 6 and 255 characters
- Address must contain an ‘@’ sign
- Quoting can be done by enclosing a label in double quotes (")
- Escaping may be done with a backslash before the character; an escaped backslash does not escape anything else
- Quotation marks must match unless escaped
- A quote may either occupy the entire local part, or occupy an entire label, separated by dots, inside the local part
- An @ sign must occur somewhere after the rightmost quote
- Quoted labels can include all characters, except for Tab, CR, LF, [, ] unless escaped
- Comments are indicated with parentheses
- Comments may be within comments, but any opening '(' must have a ')' to match
- Comments can occur at the start/end of labels or parts
- Characters within comment must follow the same rules as quoted labels, but square brackets are allowed
- There must be only one unquoted and uncommented ‘@’ sign
- The @ sign must have something before it and at least 4 characters after it
- Both the local part and the domain must not begin with a dot, end with a dot, or contain successive dots unless quoted/commented
- The local part must be between 1 and 64 characters
- The local part must not contain these characters: ) \ , : ; < > [ ] Tab CR LF unless they are quoted/commented
- The domain must be a maximum of 253 characters, minimum of 4
- The domain must contain at least one dot
- Labels (dot separated strings) must be 63 or less characters
- The domain must contain only alphabetical characters, digits, dots, and hyphens
- Labels in the domain must not begin with a hyphen, end with a hyphen, or contain successive hyphens
- Top level domain (everything after rightmost dot) must be more than one character
- The Top level domain must only have alphabetical and/or numerical characters
- Domain can be an ip address enclosed by square brackets “[“, ”]”: either IPv4 or IPv6
- Comments my occur before or after the square brackets, but not within the brackets
- IPv4 is 4 integers separated by dots
- The IPv4 integers must be under 256
- IPv6 (indicated with “IPv6:”) can be normal format or dual format
- Normal format is 8 hexadecimal values with 1 – 4 characters
- Hexadecimal values may have the letters a – f, and digits
- Dual IPv6 format is 6 hexadecimal values separated by colons “:”, followed by an IPv4 address
- IPv6 can contain “::” once, representing insignificant zeros (allowing for an undetermined number of parts less than 8/6)
References:
Akins, T. (n.d.). Email Validation Done Right. http://rumkin.com/software/email/ Clarke, B. (2021). eMail Validator Activity Outline. eMail Validator Activity Outline.pdf Comparing E-mail Address Validating Regular Expressions (2012). CN Blogs. https://www.cnblogs.com/hyqing/p/3421730.html Fuentes, E. (2019). IP address vs domain in an email address. https://www.serviceobjects.com/blog/ip-address-vs-domain-in-an-email-address/ Haack, P. (2007). I Knew How To Validate An Email Address Until I Read The RFC. http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/ Henderson, C. (n.d.). RFC 822 Email Address Parser in PHP. https://code.iamcal.com/php/rfc822/ Hinden, R. (2006). RFC 4291 - IP Version 6 Addressing Architecture. https://datatracker.ietf.org/doc/html/rfc4291 JavaScript form validation - checking email (n.d.). W3 resources. https://www.w3resource.com/javascript/form/example-javascript-form-validation-email-REC-2822.html Klensin, J. (2004). RFC 3696 - Application Techniques for Checking and Transformation of Names. https://datatracker.ietf.org/doc/html/rfc3696 Nagar, R. (n.d.). JMail Email Address Validation. https://www.rohannagar.com/jmail/ Resnick, P. (2008). RFC 5322 - Internet Message Format. https://datatracker.ietf.org/doc/html/rfc5322 Wikipedia. (2021). Email address. https://en.wikipedia.org/wiki/Email_address