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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...