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 6874153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:09:33+00:00 2026-05-27T04:09:33+00:00

Our application has an invite page where a user can import their address book.

  • 0

Our application has an invite page where a user can import their address book. We’re using an external service to get at them, so it just puts the results into a textarea. We started out just splitting the results by comma, and quickly figured out that wasn’t going to work because of:

"Smith, Joe" <jsmith@example.com>, "Jackson, Joe" <jjackson@example.com>

It would work between the 2 entries, but also split inside them as well. Just wondering if there’s a well known fool-proof way to make this work.

Maybe regex would work? I’m pretty bad that, could anyone tip me off to what regex would extract just the emails into an array…

Something like this:

emails = recipients.scan(/.*@.*/) <<==== but i know that's not right

EDIT

Looks like something like this might work. Anyone have any suggestions if this would work for special cases:

emails = recipients.scan(/[a-z0-9_.-]+@[a-z0-9-]+\.[a-z.]+/i)
  • 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-27T04:09:33+00:00Added an answer on May 27, 2026 at 4:09 am
    ruby-1.9.3-p0 :055 >   a = '"Smith, Joe" <jsmith@example.com>, "Jackson, Joe" <jjackson@example.com>';
    ruby-1.9.3-p0 :056 >   b = a.scan(/<(.*?)>/).flatten
     => ["jsmith@example.com", "jjackson@example.com"] 
    ruby-1.9.3-p0 :057 > c = a.scan(/"(.*?)"/).flatten
     => ["Smith, Joe", "Jackson, Joe"] 
    

    The index of name / email in each array is the same, thus c[1] is the name for the b[1] email.

    Based on your comment how about his :

    ruby-1.9.3-p0 :008 > a = '"Smith, Joe" <jsmith@example.com>, "Jackson, Joe" <jjackson@example.com>';
    ruby-1.9.3-p0 :009 >   b = '"test@domain.com, test2@domain.com"';
    ruby-1.9.3-p0 :010 >   b.scan(/\w*@\w*\.\w*/)
     => ["test@domain.com", "test2@domain.com"] 
    ruby-1.9.3-p0 :011 > a.scan(/\w*@\w*\.\w*/)
     => ["jsmith@example.com", "jjackson@example.com"] 
    

    Which is pretty much the same as you added to your question, just more compact.

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

Sidebar

Related Questions

Currently, each web service for our application has a user parameter that is added
Our application has a service layer and a DAO layer, written as Spring beans.
Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument
Our application has many controls that are created dynamically. For example, a navigation pane
Our application has a couple of shell scripts that are called from web-based Oracle
Our WinForms application has been reported to occasionally just close on its own. It
Our application runs off MySQL, but a client has another application that requires SQL.
After our Ruby on Rails application has run for a while, it starts throwing
In our application through the process of developing a lot of JAR files has
My company has a ClickOnce application that has been in use with our customers

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.