Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8121597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:32:43+00:00 2026-06-06T05:32:43+00:00

I need a regular expression that will accept well-formed emails in several formats (see

  • 0

I need a regular expression that will accept well-formed emails in several formats (see below) that will be input in a comma-separated list. I have the basic email address
validation regex,

^[\w\d._%+-]+@(?:[\w\d-]+\.)+(\w{2,})(,|$) 

which can handle test cases A and B, but not the others. I also tried

^(\<)?[\w\d._%+-]+@(?:[\w\d-]+\.)+(\w{2,})(\>)?(,|$)

which was able to handle A, B, and C, but only validated the first email address in each of test cases D and E. I haven’t even gotten to testing a regex for format 3.

tl;dr Need a regex that will validate email addresses 1, 2, and 3.

Good website to test your regular expressions: Online Javascript Regex Tester

Data

Test Cases
A. nora@example.com
B. nora@example.com, fred@example.com
C. <nora@example.com>, fred@example.com
D. <nora@example.com>, <fred@example.com>
E. fred@example.com, <nora@example.com>

Email Address Formats
1. xyz@example.com
2. <xyz@example.com>
3. “xyz”<xyz@example.com>

EDIT

I flagged this as a possible duplicate of:

Validate email address in JavaScript?

which, in turn, seems to be a duplicate of:

Using a regular expression to validate an email address

both of which contain much discussion on the validity of regex as email validation. However, the top-voted regexes provided don’t seem to do quite what I want so I don’t consider this answered yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:32:44+00:00Added an answer on June 6, 2026 at 5:32 am

    None of the links or answers provided was the best answer for this question. Here’s what solved it:

    /*
    * regex checks: must start with the beginning of a word or a left caret
    * must end with either the end of a word or a right caret
    * can handle example.example.com as possible domain
    * email username can have + - _ and .
    * not case sensitive
    */
    var EMAIL_REGEX = /(\<|^)[\w\d._%+-]+@(?:[\w\d-]+\.)+(\w{2,})(\>|$)/i;  
    var emails = emailList.trim().split(',');  
    var validEmails = [];  
    var invalidEmails = [];  
    
    for (var i = 0; i < emails.length; i++) {  
        var current = emails[i].trim();
        if(current !== "") {
            //if something matching the regex can be found in the string
            if(current.search(EMAIL_REGEX) !== -1) {
                //check if it has either a front or back bracket
                if(current.indexOf("<") > -1 || current.indexOf(">") > -1) {
                    //if it has both, find the email address in the string
                    if(current.indexOf("<") > -1 && current.indexOf(">") > -1) {
                        current = current.substr(current.indexOf("<")+1, current.indexOf(">")-current.indexOf("<") -1);
                    } 
                } 
            }
            if(EMAIL_REGEX.test(current)) {
                validEmails.push(current);
            } else {
                invalidEmails.push(current);
            }
        }               
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a regular expression in javascript that will accept only positive numbers and
I need a regular expression that will not allow multiple special characters in a
I need a regular expression that will match the first letter of a song
I need to write a regular expression that will be correct for telephone number
I need a regular expression that should validate decimal point as well as range.
I need an expression that will only accept: numbers normal letters (no special characters)
I need a regular expression that will allow only a to z and 0
I need a regular expression that will replace odd number of slashes with even
I need a PCRE(Perl Compatible Regular Expression) that will match all non -images(jpg,png,tiff) from
I need a regular expression that will match any string containing at most 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.