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

  • Home
  • SEARCH
  • 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 5972497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:39:57+00:00 2026-05-22T20:39:57+00:00

i have data having emails: data pattern is like: first_name last_name email data =

  • 0

i have data having emails:
data pattern is like: first_name last_name email


data = foo bar foo@bar.com, foo baz foo@baz.com,foo foo foo@foo.com,bar@bar.com , bar baz bar@baz.com

It may contain spaces. I have to valiadte all the emails by extracting the data.
Note: There may be spaces between words so that spliting by space gives me more some unwanted data …

function validate() {
    email_data = data.split(',') // This will get the all data spliting by ','
    for (i = 0; i<email_data.length; i++) {
        email_new_data = email_data.split(' ')  //spliting data by space

        // Now I could not find the way to extract emails (only ) from data
    }
}

Any suggestion will be helpful.. thanks

  • 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-05-22T20:39:58+00:00Added an answer on May 22, 2026 at 8:39 pm

    The following function split the main data string into an array; which then can be parsed with RegExp. As far as I can tell you only want to get the email address; so, we use a Regular Expression to match an email address. If it matches, you have a valid email. If there’s no match; then basically there’s no valid email on the given segment.

    Please note that Regular Expression 100% success Email Validation is just impossible; because the RFC is just extremely complicated, check more about here: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html

    function validate() {
        data = "foo bar foo@bar.com, foo baz foo@baz.com,foo foo foo@foo.com,bar@bar.com , bar baz bar@baz.com";
        email_data = data.split(','); // This will get the all data spliting by ','
        for (i = 0; i < email_data.length; i++) {
            // Get emails, change console.log to alert if you don't know how to use console.
            console.log(email_data[i].match(/[\w._+-]+@[\w._+-]+\.[\w]{2,6}/));
        }
    }
    validate();
    

    Working example:

    http://jsfiddle.net/kuroir/H7VaT/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data that looks like CUSTOMER, CUSTOMER_ID, PRODUCT ABC INC 1 XYX ABC
I have data from a table in a database (string) that contain text and
I have data that looks like this: entities id name 1 Apple 2 Orange
I have data in an MYSQL database that looks like this: Project Date Time
If I have an ArrayList that has lines of data that could look like:
I have a data model that includes common columns like addedBy, editedby (user), addedDate,
I have some data which I am formatting like this: // ... imagine populating
I'm having an image that i have added to the image folder in app_data
I have data in a MySQL database. I am sending the user a URL
I have data coming from the database in the form of a DataSet .

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.