Not able to Split properly

Hi Team ,

I am trying to split the below format.I need only the email address as"".
Please help me out
firstname lastname emailaddress starts here below is the string i have


did you try using regex??
to extract only mail ID?


have a look at this it’s extracting the required field!


1 Like

Thanks for your quick response.

The above extract is giving this **[]

But i need as this .

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

Snegha β†’
Snehal β†’

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


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 **[]

But i need as this

@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.+(?=@).+(?<”)

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

But i need only

Can I have few more examples

β†’ (i need this from above string)
β†’ (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!

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