Splunk Search

Regex help!

sumanssah
Communicator

Hello All,

Need assistance in regex creation.

I want to remove every thing before an character.

Example:

/REGISTRY/MACHINE/Software/Microsoft/Windows/CurrentVersion/Explorer/Browser Helper Objects/{B4F3A835-0E21-4959-BA22-42B3008E02FF}

Want to remove every thing before "{"

And expecting the result as
{B4F3A835-0E21-4959-BA22-42B3008E02FF}

Thanks in advance.

Regards
..............SS

Tags (2)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

In line in search you can do like this

your current search which include the fieldInFocus
| rex field=fieldInFocus mode=sed "s/^([^\{]+)(.+)/\2/g"

OR

your current search which include the fieldInFocus
| eval fieldInFocus=replace(fieldInFocus,"([^\{]+)","")

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

In line in search you can do like this

your current search which include the fieldInFocus
| rex field=fieldInFocus mode=sed "s/^([^\{]+)(.+)/\2/g"

OR

your current search which include the fieldInFocus
| eval fieldInFocus=replace(fieldInFocus,"([^\{]+)","")

sumanssah
Communicator

Thanks Soni ,

| rex field=fieldInFocus mode=sed "s/^([^{]+)(.+)/\2/g"

Work as expected 🙂

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...