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!

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 ...