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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:06:39+00:00 2026-06-07T17:06:39+00:00

I saw a few solutions and came up with the following code. My desired

  • 0

I saw a few solutions and came up with the following code. My desired result is 100.02. The required result is always between ‘my launch duration=’ and ‘mins’

mystring ='2012-07-11 22:30:33,536  INFO: 00/00/164/ABCTimeTest: my launch duration= 100.02 mins|z-vndn'
mypattern = /^.*=([^mins]*)/
subst = mystring.match(mypattern)
puts subst

output with the above code: 2012-07-11 22:30:33,536 INFO: 00/00/164/ABCTimeTest: my launch duration= 100.02

Whats wrong in my pattern? correct me with my understanding of this pattern.

#/
#^.*=             ## move from start till = (now I have reached till '=')
#([^mins])        ## capture somethings that starts with mins (thats my 100.2)
#/
  • 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-07T17:06:42+00:00Added an answer on June 7, 2026 at 5:06 pm

    It works fine for me. Don’t puts subst, as subst contains the MatchData object. The capture is inside $1 or subst[1].

    mystring ='2012-07-11 22:30:33,536  INFO: 00/00/164/ABCTimeTest: my launch duration= 100.02 mins|z-vndn'
    mypattern = /^.*=([^mins]*)/
    subst = mystring.match(mypattern)
    
    # Contains extra whitespace, so call .strip
    puts $1.strip
    # 100.02
    
    # Or ...
    puts subst[1].strip
    # 100.02
    

    To get the 100.02 without the extra whitespace, you can use the following:

    mypattern = /^.*=\s*([^\smins]*)/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw the following fragment of C code in a text book and it's
I saw that there are few topics with the same exception, but the solutions
i saw few android apps got the interface similar with itune(as attached), user can
i did a few searches and i saw a few people try to do
Today I saw a demonstration of the episerver cms and it had a few
I saw some code when studying the open source project: here . But I
I saw comment If you have 50 million values between 10 and 15 characters
I saw a few libraries through a quick Google search. What's generally the most
I'm searching for this for quite some time now. I saw few similar questions
I am not very good with STL and I saw few post similar to

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.