Split function with last tag as a new blank line

Hi Guys
I have data below screen shot and I need only data
between “Project Contact(s):” and “Link Commissioning Market” e mail Id’s
and I am using this split methord
“str_EmailBody.Split({“Project Contact(s):”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(1).ToString.Trim.Split({“Link”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(0).ToString.Trim”
but what happen in some E-Mail I got which have “Link Commissioning Market” tag exist and in some data only new blank line can you please help me how to use blank line tag
apart from Link Commissioning Market tag


Hello @Aleem_Khan,

With regex you can get it:


can you please help me on split method how to give condition as blank line apart from Link Commission Market tag

With this you are doing a condititional. If word “Link” exists it will delete the part of Link comissioning. If word doesnt exist, it will just get emails!

If (str_EmailBody.Split({“Project Contact(s):”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(1).Contains(“Link”), str_EmailBody.Split({“Project Contact(s):”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(1).ToString.Trim.Split({“Link”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(0).ToString.Trim , str_EmailBody.Split({“Project Contact(s):”.ToString.Trim},StringSplitOptions.RemoveEmptyEntries)(1))

For now this is working thank you so much and really appreciate
Can you please explain this regex to learn something new.

The best way to learn regex is testing. But first you can have a look at this documentation:

Basically, regex is a way to find characters with a pattern. The case above is a bit complicated. There are easier cases.

its working but only get one e mail id in E-Mail body the e mail id’s is dynamic
sometime one sometime more, can you please help me for that ?

Yes, of course!

Is it ok for you do it with regex? It is easy, and you dont need to check if “Link” word exists…

  1. Read Email body → str_EmailBody

2.Matches activity →

Create a variable (In this case I put Collection). This one is IEnumerable . That means that emails are saved in the variables similiar like Lists or Arrays do.

So, then we can iterate through the variable with a For Each activity to get each email:


Inside the For each I put a log message activity so you can check that each email is caught.

Hope it helps!

1 Like

@Aleem_Khan ,

Please refer to the thread below,


Check out my Regex MEGAPOST. It details how I learnt regex :wink:

Further to what @Angel_Llull said, Regex is simply a tool for matching a pattern of text within a larger body of text. You can use it to extract one item or a collection of results.

Hopefully this helps you :blush:

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