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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...