Splunk Search

how to extract fields using regex

umsundar2015
Path Finder

I have the below values in a field ,

Sadf123.dfd.com
er-md-kt-mgmt.com
feb-fe345@tbm.com

I need to extract the values like below ,
Sadf123
er-md-kt
feb-fe345

Can anyone help me to extract this

Tags (2)
0 Karma

493669
Super Champion

Hi @umsundar2015,
Try This:

...|rex "(?<string>\S+)[\.|\-|@]\w+\.com"
0 Karma

umsundar2015
Path Finder

thank you .

String here means the field name rit ?

0 Karma

493669
Super Champion

string is the field name to be extracted...
here I assume that before your .com you need to extract till any special characters(like . or - or @) comes...
Please provide your raw data where it wont work
have a look at regex101 which is helpful site for trial https://regex101.com/r/088pwQ/1

0 Karma

umsundar2015
Path Finder

This is not working , it displays values like
wkspfbtl18.devqa

Can you please help with other regex

0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...