Splunk Search

How to split a string into 2 separate fields in Splunk 6.5.0?

HeinzWaescher
Motivator

Hi,

before Splunk 6.5.0 I used commands like this to split strings into separate fields.

For fields like productId=abc_text_def

 | rex field=productId "(?<field1>.*)\_text_(?<field2>.*)"

Since 6.5.0 this does not work anymore. The error is:

Error in 'rex' command: Encountered the following error while compiling the regex '(?<field1>.*)\_text_(?<field2>.*): Regex: unrecognized character follows \

Can you help me to fix this?

0 Karma
1 Solution

cmerriman
Super Champion
| rex field=productId "(?<field1>.*)_text_(?<field2>.*)"

try it without the \ does it work?

View solution in original post

cmerriman
Super Champion
| rex field=productId "(?<field1>.*)_text_(?<field2>.*)"

try it without the \ does it work?

HeinzWaescher
Motivator

that was fast & easy, thanks a lot 🙂

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...