How to get Name from Email Address

Hi to all,

I need to get the Name and Surname from an email address.
The email address has this structure: (.com, net … etc.)

I would like to get “Name Surname” and remove everything after the @
Is this possible, considering that the names after the @ might be different?

Hi Aaron,

If I had to do it in a single line of code, I would do it the following way:

NameAndSurname=strConv(Split(email,"@".toCharArray)(0).Replace("."," "),vbstrConv.ProperCase)

This would return the Name and Surname splited. SideNote: if you are getting the email address from an actual mail, the Address object normally has a Property called DisplayName which would correlate as well

1 Like

Hi @AaronMark

You can Try with Regex Condition



Try the below regex in assign activity by replacing the variable “strInput” with your email id variable.

system.Text.RegularExpressions.Regex.Match(strInput,"^\w*(?=\.)").ToString + " " + system.Text.RegularExpressions.Regex.Match(strInput,"(?<=\.)\w*(?=\@)").ToString

Hi Aaron,
Try this more simpler way, u can either grab the email username and company name by twitching index of array

email.xaml (7.1 KB)

Hope it helps


It Work Well!!
If you have time … can you explain to me what the instructions do?

strConv(Split(email,"@".toCharArray)(0).Replace("."," "),vbstrConv.ProperCase)

Split, it separates everything that is before the snail from what is after. (I believe).
Replace… ok… replate . with space…
and last ? .propercase?

Hi @AaronMark,

Yes you got right the Split and the Replace part. @ranjith solution would also work, to do the same as those two functions combine. Regex is always more elegant.

strConv(yourStringVariable,vbStrConv.ProperCase) will turn the letter of any starting word inside yourStringVariable to Upper case and all the others to lower case–> Aka Proper casing.

Example: strConv(“hi aLL”,vbStrConv.ProperCase)–> “Hi All”.

I’m not sure if this was actually a requirement of your question or not.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.