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!

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