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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:08:00+00:00 2026-05-28T06:08:00+00:00

I have unfortunately wandered into a situation where I need regex using Ruby. Basically

  • 0

I have unfortunately wandered into a situation where I need regex using Ruby. Basically I want to match this string after the underscore and before the first parentheses. So the end result would be ‘table salt’.

_____ table salt (1)   [F]

As usual I tried to fight this battle on my own and with rubular.com. I got the first part

^_____ (Match the beginning of the string with underscores ).

Then I got bolder,

^_____(.*?) ( Do the first part of the match, then give me any amount of words and letters after it )

Regex had had enough and put an end to that nonsense and crapped out. So I was wondering if anyone on stackoverflow knew or would have any hints on how to say my goal to the Ruby Regex parser.

EDIT: Thanks everyone, this is the pattern I ended up using after creating it with rubular.

ingredientNameRegex = /^_+([^(]*)/;

Everything got better once I took a deep breath, and thought about what I was trying to say.

  • 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-28T06:08:01+00:00Added an answer on May 28, 2026 at 6:08 am

    Try this: ^[_]+([^(]*)\(

    It will match lines starting with one or more underscores followed by anything not equal to an opening bracket: http://rubular.com/r/vthpGpVr4y

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

Sidebar

Related Questions

I have a Rails application that unfortunately after a request to a controller, has
I have been using UIViewController s and initWithNibName with much success, basically using them
I (unfortunately) have some dates that were saved into varchar columns. These columns contain
(Why I am trying to do this: I have had no luck in using
I have been working on this for a while now and, unfortunately have little
We want to update an existing Application but unfortunately we have a problem. Our
I am new to Yii and want to integrate file uploading.Unfortunately I have not
Over the past couple of days I have been reading into using autotools to
I have unfortunately fallen victim to this recent attack: http://www.theregister.co.uk/2011/10/14/mass_website_inection_grows/ . I have found
I'm using the onSelect setting of the jQuery UI datepicker. Unfortunately I have two

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.