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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:31:49+00:00 2026-06-18T00:31:49+00:00

I have a problem to grab value that having a space from my Regex.

  • 0

I have a problem to grab value that having a space from my Regex.
Can anyone help me to provide to the correct regex with using key-value mechanisme. Please take note that the key-value position might change and does not fixed.

Regex

\s*([\w\d_]*)=(.*?)\s+

Input

spt=38271 deviceExternalId=SUKUK node 1 dst=99.111.185.141 app=HTTPS rt=Jan 23 2013 15:30:45 deviceFacility=Packet filter msg=Connection was reset by server destinationTranslatedPort=443 

My result

Match 1: spt=38271 
    Subgroups:
    1: spt
    2: 38271
Match 2: deviceExternalId=SUKUK 
    Subgroups:
    1: deviceExternalId
    2: SUKUK
Match 3:  dst=99.111.185.141 
    Subgroups:
    1: dst
    2: 99.111.185.141
Match 4: app=HTTPS 
    Subgroups:
    1: app
    2: HTTPS
Match 5: rt=Jan 
    Subgroups:
    1: rt
    2: Jan          **==>Should grab [Jan 23 2013 15:30:45]**
Match 6:  deviceFacility=Packet 
    Subgroups:
    1: deviceFacility
    2: Packet       **==>Should grab [Packet filter]**
Match 7:  msg=Connection 
    Subgroups:
    1: msg
    2: Connection   **==>Should grab [Connection was reset by server]**
Match 8:  destinationTranslatedPort=443 
    Subgroups:
    1: destinationTranslatedPort
    2: 443
  • 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-18T00:31:50+00:00Added an answer on June 18, 2026 at 12:31 am

    Try this one:

    ([\w\d_]+)=(.*?)(?=\s+[\w\d_]+=|$)
    
    print "$1\n$2";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having a problem using the javascript API of the RadComboBox from Telerik.
I am programming a script that will grab some data from my website using
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with UIWebView delay when the load image from url. In my
I have the unfortunate luck of having to deal with a db that contains
I wonder if anyone can help me or point me in the right direction.
I'm having this strange problem when i try to access elements in json from
I have implemented my own class that inherits from the SettingsProvider class. If the
I have a loop in php that echos out a <input type=hidden id=lol value=$id
I'm attempting to grab the value from the file input in html and placing

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.