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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...