I think you can attempt to do something like this:
Create a new Custom user validator to do your own custom validation( You can use a regex as well for validations):
public class CustomUserValidator<TUser> : IIdentityValidator<TUser>
where TUser : class, Microsoft.AspNet.Identity.IUser
{
public CustomUserValidator(UserManager<TUser> manager)
{
_manager = manager;
}
public async Task<IdentityResult> ValidateAsync(TUser item)
{
// Your custom validation here
}
}
and then when you are creating your application user manager you can set the Default user validator to an instance of this new validator class:
manager.UserValidator = new CustomUserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
[NOTE:]
default validator is like:
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
};