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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:09:39+00:00 2026-06-14T12:09:39+00:00

Are we suppose to use regex with for loop? For example If I want

  • 0

Are we suppose to use regex with for loop?
For example If I want to ensure the user entering bunch of email in a text-box in the format like below, What is the best way to do it ?

Zoo bbb <zoo@email.com>, Alan T <at@gmail.xxx>, ........

How do we extract the information and put in names[], emails[].?

  • 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-14T12:09:40+00:00Added an answer on June 14, 2026 at 12:09 pm

    If you wanted to use regex the following pattern would match:

    <([\w+\.\@]+)>+
    
    
    Match 1
    1.  zoo@email.com
    Match 2
    1.  at@gmail.xxx
    

    You can test it out on: http://rubular.com

    What you would do is count the matches found by using scan

    here is the example code i put together

    s = "Zoo bbb <zoo@email.com>, Alan T <at@gmail.xxx>"
    
    names = []
    emails = []
    
    s.scan(/[\s]?([\w\s]+)<([\w+\.\@]+)>+/).each do | m |
      names << m[0]
      emails << m[1]
    end
    
    puts "names = #{names}"
    puts "emails = #{emails}"
    

    output:

    names = ["Zoo bbb ", "Alan T "]
    emails = ["zoo@email.com", "at@gmail.xxx"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I use a custom :format to implement a gadget-oriented version of my site.
Suppose I have a function like this (I use akka 2.0.2): def foo(message: String):
Suppose I have 2 office locations which I want to use for my contact
Suppose I have a Window with TextBoxes I want to use the values. Right
I use php with ajax. <?php /* * Suppose, user has entered both correct
suppose i wrote my javascript in my aspx page like below <script type=text/javascript> function
Suppose I have these line: /path-to-something/section/resource?var=name /path-to-something/section/resource I want to use regular expression to
I need help getting the regex format of my usernames correct. It suppose to
Suppose I have a string of HTML code. I want to use JQuery to
Suppose I have a string like this: abc%\%%%% I want to replace multiple %%%

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.