Splunk Search

Concatenate onto Regex

edschembor
Path Finder

I'm trying to concatenate something onto one of my regex's.

ie:

index=eph | rex "EPH(?P<EPHID>\d+)" | table EPHID, _raw

I want the EPHID regex to be EPH902834091 instead of just 902834091. So even though the regex is "EPH(?P\d+)", I want the "EPH" at the beginning included. Is there a way to do this?

Thanks!!!

1 Solution

aweitzman
Motivator

Why not just include it in the group?

rex "(?<EPHID>EPH\d+)"

View solution in original post

Ayn
Legend

Just include the EPH in the matching group.

index=eph | rex "(?<EPHID>EPH\d+)" | table EPHID, _raw

aweitzman
Motivator

Why not just include it in the group?

rex "(?<EPHID>EPH\d+)"

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