Splunk Search

Replace square brackets and leave original value

korstiaans
Explorer

Hi All,

I have a field with the following value:

[ "842cef72-745d-463c-8b49-ce16ccc5ebd2" ]

I'd like to get rid of the square brackets and the quotes ending up with:

842cef72-745d-463c-8b49-ce16ccc5ebd2

Labels (2)
0 Karma
1 Solution

clintla
Contributor

Sorry- added incorrectly \

(?<CAPTURE>[a-z0-9-]+)

View solution in original post

michel_wolf
Path Finder

Hi korstiaans,

you can try this:

|makeresults
|eval sample_field="[ \"842cef72-745d-463c-8b49-ce16ccc5ebd2\" ]"
|rex field=sample_field "\[\s\"(?<new_field>.*)?\""

I don´t know if you have realy spaces between the [ and "

Michel

clintla
Contributor

(?<CAPTURE>[a-z0-9-\]+)

0 Karma

clintla
Contributor

Sorry- added incorrectly \

(?<CAPTURE>[a-z0-9-]+)

korstiaans
Explorer

@clintla Thanks, works like a charm. 

0 Karma

korstiaans
Explorer

Hi Michel,

That doesn't work, but it's probably, because the field is a little weird formatted. It looks like this in a table:

 

splunk_answers.png

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...