Splunk Search

Interactive Field Extraction (regex)

sbnoobbb
Path Finder

I have my data here Xml Data, I need to extract using Splunk IFX, Generated pattern (regex).

Example 1: (22/7)19:55 Accident on ECP (towards Changi Airport) after Maxwell Rd Entrance. Avoid lane 1./d:Message
Example 2: (22/7)14:29 Accident on ECP (towards Changi Airport) before Fort Rd Exit. Avoid lane 5./d:Message
Example 3: (19/7)15:19 Accident on PIE (towards Changi Airport) before Paya Lebar Rd with congestion till Kallang Way. Avoid lane 5./d:Message

Help 1: I need to extract the express-way exits on the word after and stops at .

Help 2: I need to extract the express-way exits on the word before and stops at Exit

Help 3: I need to extract the express-way exits on the word before and stops at with

There are still a lot of examples in the Xml Data.

I did (?i) before (?P<wordafter>.[^\.]*?Exit) , this extracts the Fort Rd Exit (Example 2), this extract only before, how can I extract after ? together with this expression.

0 Karma
1 Solution

sbnoobbb
Path Finder

After hours of trying, solved by (?i) (?Pat|after|before) (?P[^.]*?(?PExit.|Rd.|Entrance.|Ave.|Avenue.|North.|[1-9].|BKE.|SLE.|CTE.|ECP.|KJE.|TPE.|PIE.|AYE.))

View solution in original post

0 Karma

sbnoobbb
Path Finder

After hours of trying, solved by (?i) (?Pat|after|before) (?P[^.]*?(?PExit.|Rd.|Entrance.|Ave.|Avenue.|North.|[1-9].|BKE.|SLE.|CTE.|ECP.|KJE.|TPE.|PIE.|AYE.))

0 Karma

suepfarrell
New Member

Hi

Can you tell me if i and P are exactly typed like this or you substituted field names in here?

Thinking this (with changes) may be my answer

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...