Tuesday 28 March 2017

Regex Multiple email validation

I Want to implement multiple email validation with specific domain using regex separated by ;. Requirement is to allow only two email id separated by semicolon.
I tried regex



^([\w+-.%]+@domain+\.com[~]?){1,2}$




it works fine but it validates email followed by ; . It should work as below



1) abc@domain.com valid



2) abc@domain.com;abc1@domain.com valid



3) abc@domain.com; invalid



4) abc@domain.com;abc1@domain.com; invalid




How to do it using regex?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...