Splunk Search

How to use rex to extract username from emailid?

eduspk
Explorer

Hi All

Please help me to extract username from the emailid.

Ex:

test123@test.com
abc2@test.com

Required:

test123
abc2

Thanks

0 Karma
1 Solution

vnravikumar
Champion

Hi @eduspk

Try like

| makeresults 
| eval emailid="test123@test.com" 
| rex field=emailid "(?P<username>.*)\@"

View solution in original post

vnravikumar
Champion

Hi @eduspk

Try like

| makeresults 
| eval emailid="test123@test.com" 
| rex field=emailid "(?P<username>.*)\@"
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...