Good day,
I'm looking for a regular expression that would validate the following email addresses:
a@domain.com, b@domain.com
So far, I have this:
^([\w+-.%]+@domain\.com,?\s*)+$
It should not return anything in case of:
a@domain.comb@domain.com or
a@domain.com b@domain.com
Any help would be appreciated.
The regex you are looking for is ^(?>\b[\w+-.%]+@domain\.com(?:[,;]\s*)?)+\b$
.
I am using atomic grouping with (?>...)
so that no backreferences are created.
Result is as you request: a@domain.com, b@domain.com
Also tested with Expresso.