Before I jump into my question, let me preface with this: I had a strict set of requirements to follow with regards to email address validation. I attempted to dispute some of them, but was overruled.
Anyways, amongst the requirements were the following:
- No consecutive periods
- No special characters in pos 1
- No periods directly before or after the @
- Allow the following characters: +!#$%&*/=?`{|}~'_-.
My attempt to satisfy the requirement was successful, with one snag. An incorrect minimum of 3 characters is now required due to the regex I am using for the local part. Here is my attempt:
(^(?!.*\\.{2})([a-zA-Z0-9{1}]+[a-zA-Z0-9\\._\\-\\+!#$%&*/=?`{|}~']+[a-zA-Z0-9{1}])+@([a-zA-Z0-9{1}]+[a-zA-Z0-9\\-]+[a-zA-Z0-9{1}]+\\.)+([a-zA-Z0-9\\-]{2}|net|com|gov|mil|org|edu|int|NET|COM|GOV|MIL|ORG|EDU|INT)$)|^$
I understand why this is happening, I just don't know how to get around it. Any assistance would be greatly appreciated.
Edited: After much discussion, it turns out that my issues were not specific to the local part of the email address. The domain part is also suffering from the same issues.
Thanks, Seb