To be able to create users with apostrophes you need to use both CMSEmailValidationRegex and CMSUserValidationRegEx web.config keys in the admin app's config file (and if you want to use it for live site, then in the front end app's web.config/appsettings.json file too). One overrides the email validation and the other one whe username validation - you can have them set separately. But in this particular case, both have to allow + and ' signs.
For testing this regex was used (found online):
^([a-zA-Z0-9_\-\.+']+)@([a-zA-Z0-9_\-\.+']+)\.([a-zA-Z]{2,5})$
It is a regex to check the email address plus he single apostrophe (') was added to be allowed before the @ sign.
< add key="CMSEmailValidationRegex" value="^([a-zA-Z0-9_\-\.+']+)@([a-zA-Z0-9_\-\.+']+)\.([a-zA-Z]{2,5})$"/ >
< add key="CMSUserValidationRegEx" value="^([a-zA-Z0-9_\-\.+']+)@([a-zA-Z0-9_\-\.+']+)\.([a-zA-Z]{2,5})$"/ >
For the live site, we used the .NET Core app adding the above keys to the appsettings.json is required too:
"CMSEmailValidationRegex": "^([a-zA-Z0-9_\\-\\.+']+)@([a-zA-Z0-9_\\-\\.+']+)\\.([a-zA-Z]{2,5})$",
"CMSUserValidationRegEx": "^([a-zA-Z0-9_\\-\\.+']+)@([a-zA-Z0-9_\\-\\.+']+)\\.([a-zA-Z]{2,5})$",
But, this is not enough (there is always some BUT.....) - there is also the native .NET Core identity in play which is validating the email format. Based on the research on Stackoverflow there are these solutions:
Thread 1 link
Thread 2 link
They are basically the same - one is setting null to the allowed characters and the other one is extending the default list. I tried both and they seem to work. So, you can have something like this in the Startup.cs:
options.User.AllowedUserNameCharacters = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+ ";"
or just like this:
options.User.AllowedUserNameCharacters = null;