0

I have this regular expression for email validation:

/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

But this is not working for emails like:

[email protected]

How do I change the above regular expression for this requirement?

3

2 Answers 2

1

You forgot to add RegEx for the '+' symbol

^\w+([\.+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$
Sign up to request clarification or add additional context in comments.

Comments

0

+ was not icluded in your regex pattern. I have added that. Hope this works.

^\w+([\.\-\+]?\w*)*@\w+([\.-]?\w+)*(\.\w{2,3})+$

1 Comment

@pranami. Thank you for approving the answer. Happy to have an upvote aswell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.