Splunk Search
Highlighted

How to use rex to extract username from emailid?

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
Highlighted

Re: How to use rex to extract username from emailid?

Champion

Hi @eduspk

Try like

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

View solution in original post