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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:28:27+00:00 2026-05-21T14:28:27+00:00

I am new to regex and need to parse a comma-separated input of email

  • 0

I am new to regex and need to parse a comma-separated input of email address extensions (everything after the @ symbol). Example:

foo.bar,foo.bar.baz,foo-bar.baz

I know that there are no whitespaces in the string. Also. following is the regex I want to use for just a single email extension:

/[a-z\d\-.]+\.[a-z]+\z/i

How do I modify the regex in Ruby to work with multiple extensions which are comma separated?

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-21T14:28:28+00:00Added an answer on May 21, 2026 at 2:28 pm

    You’re probably better of splitting the list into components and then checking each component:

    hosts  = 'foo.bar,foo.bar.baz,foo-bar.baz'
    all_ok = true
    hosts.split(/\s*,\s*/).each do |host|
        all_ok = false unless(host =~ /[a-z\d\-.]+\.[a-z]+\z/i)
    end
    

    That may not be a one-liner but it will probably be a lot easier to understand six months down the road (unless, of course, your regex-fu gets stronger).

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

Sidebar

Related Questions

I need to parse string that looks like in example below: Regex TitleRegex =
Im totally new to regex. I need your help. What is the regex function
I'm rather new to regex expressions and need help with a simple expression. I'm
i want to parse VB6 code via Regex. However being new to Regex I
i'm trying to learn regex parse in javascript. I need to read the text
I need to parse sections from a string of HTML. For example: <p>Lorem ipsum
New to regex and I need to pattern match on some dates to change
I have this: var blockRegEx = new Regex((proc sql;)(.*?)(quit;), RegexOptions.IgnoreCase | RegexOptions.Multiline); but it
Currently I am using this code: var regex = new Regex(@<span id=point_total class=tooltip oldtitle=.*?
I used it in C# var validString = new Regex(@^[a-z][a-z\d!@#$%\^&*()\-+]{0,7}$(?<=\d\D+), RegexOptions.Compiled); I am trying

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.