Solved

Extract only email domain

  • 15 September 2022
  • 8 replies
  • 104 views

Userlevel 3
Badge +5

Hi all,

I'm trying to extract our users email domain which identifies our clients. Is there any REGEX split a string after the "@" so that I only get the domain. On top of that I want to create a new user property.

Best regards,

Bernardo Madeira

icon

Best answer by gwen.pasch 16 September 2022, 17:51

View original

8 replies

Userlevel 3
Badge

Hi Bernardo! I would try the following Regex: @(.+)

This is how I would set it up in my Heap account:

 

Userlevel 3
Badge +5

Thank you! Is there any documentation for regex extraction?

 

Userlevel 3
Badge +5

And how can I extract also the .com, .de, etc?

 

Userlevel 3
Badge

Heap’s documentation links to RegexOne (which is where I learned my Regex basics) and Regular Expressions 101 (which is what I always use to test my Regex syntax before putting it in Heap. Hope that helps!

Userlevel 3
Badge

This is what I would do to just extract the .com, .de, etc. Is this what you’re asking? Regex would be .+\.(.+)

 

Userlevel 3
Badge +5

I want to extract only the domain and exclude the .com, .dt etc

 

Userlevel 3
Badge

Ah! Apologies, I would try this regex @(.+)\..+. Screenshot below!

 

Userlevel 3
Badge +5

Thank you! This is really helpful!

 

Reply