All Apps and Add-ons

How do we extract from a character "-" till the end of the line?

royimad
Builder

My events look like this
Event1: blah blah - blah blah ANY CHARACTERS
(multilines could exist after the first lines and sometime my event is with a single line)
Event 2: blah blah .... - blah blah

How to extract from character "-" till the end of the first line, how to do that?.
I have tried (?-.*\n) but my second event didn't appear with single line.

0 Karma
1 Solution

royimad
Builder

This is the solution:

(?P-.*[\r\n]+)

View solution in original post

0 Karma

royimad
Builder

This is the solution:

(?P-.*[\r\n]+)

0 Karma

kristian_kolb
Ultra Champion

Didn't this work?

http://splunk-base.splunk.com/answers/83324/can-i-write-a-conditional-regular-expression

Questions/observations:
By ANY CHARACTER, I assume that includes dashes/hyphens as well?
Don't you want \s-\s(?<your_field>.*)$ (remember that the dollar sign is the end of the line)
Please post some real events.

/K

royimad
Builder

Thanks for the suggestion it is the right answer \s-\s(?.*)$ is working great

0 Karma

royimad
Builder

The extraction that you suggested is working well, Great

0 Karma

royimad
Builder

ok, This is great also
(?P-.*[\r\n]+)

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Nested loops in Event Conversion

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

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...