I have to check a users input against their in-putted email to check if they are too similar, if they are I need to throw an error. For example;
“The user name can’t be too similar to the email address e.g. if the email address is charlie@hud.ac.uk the username can’t be charlie.”
How could I go about doing this?
EDIT: I want to check the username against the first section of the email address, the section before the @
This will compare the username with the username part of email.
Edit:
The point is you could get the username part from the email by
email.split('@')[0], then how similar is defined by you.