Splunk Search

How to extract string between two character @ and >?

DavideASR
Engager

Hi,

I'm trying to extract string "domain.com" from <mail@domain.com>

How can i extract string between "@" and ">" ?

Thx

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @DavideASR,

please try this,

| rex "@(?<domain>[^\<]+)"

that you can test at https://regex101.com/r/Bffr7q/1 

if you have the above value in another field (e.g. email), you could use

| rex field=email "@(?<domain>[^\<]+)"

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @DavideASR,

please try this,

| rex "@(?<domain>[^\<]+)"

that you can test at https://regex101.com/r/Bffr7q/1 

if you have the above value in another field (e.g. email), you could use

| rex field=email "@(?<domain>[^\<]+)"

Ciao.

Giuseppe

Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...