One email check that must be done is at data entry time to catch the user entering an obviously wrong email address. I do NOT think the best way to do that is to create a Single RegEx complicated expression. All that can do is tell the user the address Invalid (as seen above). This can leave a puzzle for user as to why specifically, and tech support, and maybe is kicked up to development (me) to answer why it is wrong.
This Email Validation topic covers some of what I am saying. The link goes to where I identify 4 specific things to tell the user, like there is no “@”, or two “@”''s, or double periods, etc. There are more.
A better example is this topic that requested a single RegEx expression to check is a Password met the requirements of
Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character
I think the better way is to step through each requirement and tell the user exactly what is missing. This is example code, better would be to concatenate the errors into a single message.
PasswordBad PROCEDURE(STRING pwd),STRING
CODE
IF LEN(CLIP(Pwd)) < 8 THEN RETURN 'Minimum eight characters'.
IF ~MATCH(Pwd,'[A-Z]',Match:Regular) THEN RETURN 'at least one uppercase letter '.
IF ~MATCH(Pwd,'[a-z]',Match:Regular) THEN RETURN 'one lowercase letter '.
IF ~MATCH(Pwd,'[0-9]',Match:Regular) THEN RETURN 'one number ' .
IF ~MATCH(Pwd,'[^A-Z^a-z^0-9]',Match:Regular) THEN RETURN 'one special character '.
IF INSTRING(CHR(32),CLIP(Pwd)) THEN RETURN 'No Spaces'. !Suggested
RETURN '' !Ok
In summary, if your trying to communicate to the User IMO it’s better to split the checks into parts so you can provide detailed errors instead of just saying “something is invalid”. I worked on software used by 1000’s of users, with 10 in Tech Support, you want error messages as helpful as possible.