I have an existing email address validation Regex and am looking for an additional Regex function that will also NOT match if the sample ends with .ocm.
The reason for this request is to provide additional data entry validation to prevent the most common typo we encounter: .ocm instead of .com.
For example, blah@somewhere.com
should return a match, but blah@somewhere.ocm
should not.
I'm afraid I don't know what flavor of Regex I'm using, as it's in a black box proprietary application that "accepts Regex" for user input validation. I do know that the application is probably written in VB6 if that helps at all.
Here is the existing Regex, which works well for its intended purpose:
^(?=[a-zA-Z0-9][a-zA-Z0-9@._%+-]{5,253}$)[a-zA-Z0-9@._%+-]{1,64}@(?:(?=[a-zA-Z0-9-]{1,63}\.)[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*\.){1,8}[a-zA-Z]{2,63}$
The sample will always be a greater-than-zero-length string, so it doesn't matter if these aren't handled.
It seems that a negative lookbehind at the end of the Regex should be the best method, but I can't find the correct syntax to make this work with my existing Regex. Here are some methods that might work if someone could kindly suggest how to integrate them with my existing Regex:
https://stackoverflow.com/a/406408/6195684
https://code.i-harness.com/en/q/fa3887
https://stackoverflow.com/a/11432373/6195684
Thanks kindly in advance.