Splunk Search

Regex expression correction

kailun92
Communicator

I used (?i)location : (?P.+) to extract the location. But it always extract the word below it (None). Anyone knows how to solve this ? I need to extract only Choa Chu Kang.

My data is

cloudCover : 0.75
dewPoint: 21.42
humidity: 54.00
icon : partly-cloudy-day
ozone : 274.19
precipIntensity : 0.003
precipProbability : 0.04
precipType : rain
pressure : 1007.45
summary : Mostly Cloudy
temperature: 31.68
visibility : 6.21
windBearing : 139
windSpeed : 11.9
psiAverage : 19
latitude : 1.394557
longitude : 103.746396
location : Choa Chu Kang
None

Tags (2)
0 Karma
1 Solution

okrabbe_splunk
Splunk Employee
Splunk Employee

You could try something like this which is a bit more explicit.

(?im)^location\s:\s(?P<current_location>[^\n]+)

View solution in original post

okrabbe_splunk
Splunk Employee
Splunk Employee

You could try something like this which is a bit more explicit.

(?im)^location\s:\s(?P<current_location>[^\n]+)

kailun92
Communicator

Thanks ! it works

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...