Not able to Split properly

Hi Team ,

I am trying to split the below format.I need only the email address as"snehamayi.senapati@tx.com".
Please help me out
Eg:
firstname lastname emailaddress starts here below is the string i have
Snehamayi Senapatisnehamayi.senapati@tx.com

Thanks,
Sneha

did you try using regex??
to extract only mail ID?
Cheers
@Snehamayi_Sneha

image

have a look at this it’s extracting the required field!
([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,6})

cheers
@Snehamayi_Sneha

1 Like

Thanks for your quick response.

The above extract is giving this **[Senapatisnehamayi.senapati@tx.com]

But i need as this snehamayi.senapati@tx.com .

I have list of strings added to excel but i need only the email ids

Snehamayi Senapatisnehamayi.senapati@fujitsu.com
Snegha Misnegha.mi@tx.com β†’ snegha.mi@tx.com
Snehal KotSnehal.Kot@tx.com β†’ Snehal.Kot@tx.com

I need to make it dynamic after lastname it needs to split the emailid.

Thanks

Hi,
Use invoke code activity write code below

Dim list As List(Of String)=(From a In Split(MailAddresses," β€œ)
Where Regex.IsMatch(a,”^([\w.-]+)@([\w-]+)((.(\w){2,3})+)$")
Select a).ToList

where MailAddresses is string variable having space separated mail ids , here its filter out all invalid mail ids and keep only valid mail ids

1 Like

@Snehamayi_Sneha Check this :
RegexEmail.xaml (5.9 KB)

Thanks for your quick response.

The above extract is giving this **[Senapatisnehamayi.senapati@tx.com]

But i need as this snehamayi.senapati@tx.com

@Snehamayi_Sneha Have you Changed the Input? Does it come in the message box in that way?

Fine if the input is stored in a variable named strinput
Then use a assign activity like this
stroutput = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”\s.+(?=@).+(?<=.com)”)

It’s working

Cheers @Snehamayi_Sneha

yes i got the alert as image

@Snehamayi_Sneha Isn’t that the format you wanted ?:sweat_smile:

i need only snehamayi.senapati@tx.com

But i need only snehamayi.senapati@tx.com

Can I have few more examples
@Snehamayi_Sneha

Snegha Misnegha.mi@tx.com
β†’ snegha.mi@tx.com (i need this from above string)
Snehal KotSnehal.Kot@tx.com
β†’ Snehal.Kot@tx.com (i need this from above string)

1 Like

image Main.xaml (4.2 KB)
check this sample and let me know
store your FirstName in variable that would be easy!
cheers
@Snehamayi_Sneha

1 Like

@Snehamayi_Sneha Check this and Confirm with all different type of Email Strings that you have :sweat_smile: Dont know if it works for all cases
RegexEmail.xaml (6.9 KB)

1 Like

Thanks for the response some what it works but some cases it is failing.

Thanks for the response …

But the code is simple may be it will not work for dynamic strings.

Fine this expression would help you in this
If stored in strinput
Then in a assign activity

stroutput = system.Text.RegularExpressions.Regex.Replace(strinput.ToString,".+(?=[.]\w.+@)",Split(strinput," ")(0).ToString)

Cheers @Snehamayi_Sneha