Extract name from email address | Community
Skip to main content
Level 3
January 25, 2023
Solved

Extract name from email address

  • January 25, 2023
  • 1 reply
  • 1010 views

Is there any way to extract the name from an email address e.g. firstname.lastname@domain.com so that we can pull out the firstname and lastname and enter them into the name fields? I can't see anyway to do this in a query or function. There is a GetEmailDomain but not one for the name. Wondering if it's possible to use another function such as LPad?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SatheeskannaK

Hi @michaelwilding,

 

Try expression something below will give the first name,

 

Substring(Substring(@email,0,Charindex(@email,"@")), 0, Charindex(@email,"."))

 

Similar way you can get the last name.

 

1 reply

SatheeskannaK
Community Advisor
SatheeskannaKCommunity AdvisorAccepted solution
Community Advisor
January 25, 2023

Hi @michaelwilding,

 

Try expression something below will give the first name,

 

Substring(Substring(@email,0,Charindex(@email,"@")), 0, Charindex(@email,"."))

 

Similar way you can get the last name.

 

Thanks, Sathees
Level 3
January 26, 2023

Thank you, that works well. Just putting this here for reference for anybody else. I used the following in an Enrichment node:

 

First name: Smart(Substring(Substring(emailfield,0,Charindex(emailfield,"@")), 0, Charindex(emailfield,".")) )

 

Last name: Smart(Substring(Substring(emailfield,0,Charindex(emailfield,"@")), Charindex(emailfield,".")+1, Charindex(emailfield,"@")) )

 

The Smart() capitalises the first letter of each name. Don't forget the data then needs to be updated in the database once you have enriched the incoming data.