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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

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