Regular expression for validating multiple email
You should also note that the actual specification for email addresses is extremely complicated and there are many emails that will fail this test -- for example those with multiple periods in the domain.
May be okay for your purposes, but just pointing it out.
Now I wanted to extend that and allow multiple mail-addresses to be added (just like MS Outlook, for example) with a semicolon as a mail-splitter.
This is not what I want when the user only enters one e-mail.
Depends on your version of Microsoft Office, there are different ways to open VBA code editor.
When VBA code editor is opened, on the menu bar across the top, click Tools - References...
Here is a simple Program which does this for you without using the Regular Expression.It also allows a single email address that doesn't end in semicolon. You can change the final * by to require at least one address.Important note: as states in the comment by Martin, if there are additional text before or after the correct email address list, the validation will not fail. To make it work as a validator you need to add Why not just split on the semicolon and then validate each potential email address using your existing regexp ?I have seen many comments saying that the expressions in question do not work for certain cases and that they are either too strict or too permissive. What I'm looking for is a regular expression that I can use in my C# code that is definitive.
For example, entering You have very restricted and specific rules about valid email addresses that are not reflective of real email addresses.