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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...