jatin1726:
The regex defines what can and can't appear in the email address; this part:
^[A-Z0-9._%+-]+
...defines what characters can appear before the "@". The "@" ensures that there has to be an instance of the "@" symbol.
This part defines what can appear after the "@":
[A-Z0-9.-]+\.[A-Z]{2,}$
Note that neither of these parts allow "@"
This isn't the only regex that can validate emails. If you google "regex" and "email" you will find a whole bunch of other examples, some more thorough than others.
Thanks a lot for such a detailed help. God bless u.