Splunk Cloud Platform

expression to capture all the delimiters and replace with space

Splunkerninja
Path Finder

Hi,

 

I have to replace all the possible delimiters in the field with space so that I capture each word separately.

Example: 5bb2a5-bb04-460e-a7bc-abb95d07a13_Setgfub.jpg I need to remove the extension as well it could be anything so .csv or .xslx or .do

I need the output as below
5bb2a8d5

bb04

460e

a7bc

bb995d07a13

Setgfub

 

I came up with expression which works fine but i need this either in regular expression or eval expression as I am using it for data model.

 

 

| makeresults 
| eval test="ton-o-mete_r v4.pdf" 
| rex field=test mode=sed "s/\-|\_|\.|\(|\)|\,|\;/ /g"
| eval temp=split('test'," "

 

 

 

Tags (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try this rex command.  It extracts the individual fields directly.

| makeresults 
| eval test="ton-o-mete_r v4.pdf" 
| rex field=test max_match=0 "(?<temp>[^\-_\.\(\),;\s]+)"

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Try this rex command.  It extracts the individual fields directly.

| makeresults 
| eval test="ton-o-mete_r v4.pdf" 
| rex field=test max_match=0 "(?<temp>[^\-_\.\(\),;\s]+)"

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...