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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...