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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:13:45+00:00 2026-05-23T10:13:45+00:00

Needs some help with using a reg ex to get the machine name from

  • 0

Needs some help with using a reg ex to get the machine name from a string. Note there are also new lines between the name/value pairs. Here is the string:

event has happened on id=5656565655, login.user.id=5453453345, machine.name=ubuntu-1, more name value pairs here

The regex that I though was working was:

final Matcher m = Pattern.compile("machine.name=(\\.+),")

I had a W instead of the DOT before, but that missed machine names with numerics and dashes in them. Once I went to DOT I get zero matches. I need to extract the value of the machine name from the string. Will someone help me out?

  • 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-23T10:13:45+00:00Added an answer on May 23, 2026 at 10:13 am

    By putting a \ in front of the dot, you are asking for a literal dot. What you probably want is everything up to the comma, which can be done with

    final Matcher m = Pattern.compile("machine\\.name=([^,]+),")
    

    or with a non-greedy modifier:

    final Matcher m = Pattern.compile("machine\\.name=(.+?),")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

cowboy coder needs some help from SO-veterans: I have a given application that uses
Iam new to c programming and needs some help. long *taskids[NUM_THREADS]; for(t=0; t<NUM_THREADS; t++)
a newbie needs some help with logic flow: I'm using the Auto Complete extender
Need some help for creating a File and String search engine. The program needs
I need some help with overlaying views using the prism framework.Its a little more
I need some help extracting the following bits of information using regular expressions. Here
I need some help on compiler flags in c++. I'm using a library that
My web service needs to open some files located on a remote computer. From
I'm a Django newbie who needs help: Even though I change some urls in
I fairly new to regular expressions and need some help. I need to filter

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.