("^[_a-zA-Z0-9!#$%&'*+-/=?^_`{|}~;]+(\\.[_a-zA-Z0-9!#$%&'*+-/=?^_`{|}~;]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,})$")
This is my regex
for email field but I don't want to allow spaces in email. What I have to do please suggest me??
("^[_a-zA-Z0-9!#$%&'*+-/=?^_`{|}~;]+(\\.[_a-zA-Z0-9!#$%&'*+-/=?^_`{|}~;]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,})$")
This is my regex
for email field but I don't want to allow spaces in email. What I have to do please suggest me??
Unless you are trying to validate the email address as originating from a known domain, validating is practically impossible and bound to be frustrating for users with unusual addresses that your regex fails validation on.
For reference: https://davidcel.is/posts/stop-validating-email-addresses-with-regex/
Here is your current regex compared against a list of valid and invalid email addresses. As you can see, you failed to allow several, perfectly valid email addresses while still letting through around 30% of the invalid ones.