How to select specific data in a email body

hai all i have a regex expression to select specific data from the email body

Choose new costcenter: BXv GR
Choose new costcenter: Project Cloud computings

The above are example types

in the mail body we will get the data like that with other unwanted stuff . i need to extract value
after the

Choose new costcenter:

and i was storing in a variable

the regex i was using is

Regex.Replace(Regex.Replace(System.Text.RegularExpressions.Regex.Match(item.body.ToString,"(?<=Choose new costcenter:)[\s\S]").ToString, "\n.", “”).ToString,"\s","").tostring

But it was taking the value after the Choose new costcenter: as BXvGR , ProjectCloudcomputings there is no space between as in the mail body can you suggest how to get space also that

@bpt.teja1996 Can you Check if this is the Expression you needed :

System.Text.RegularExpressions.Regex.Matches(item.body.ToString,"(?<=Choose new costcenter:).*")

It returns a Match Collection, hence you’ll need to iterate and get the values.

You can check it for all data in here :

@supermanPunch but it will give all the lines after that line also I just need that part after the
Choose new costcenter:

That line enda and there will some other stuff from next line which I don’t need

@bpt.teja1996 What is the Output that you get now and what is the output that you expect, can you show with an example?

@supermanPunch I should have gap between as mentioned in the first message

Try this:

  1. Insert a ‘matches’ activity using the stored variable as the input. Insert the following regex:
    /?<=Choose new costcentre: ).*

Save as new variable: Var_Costcentre.
2. Insert write line activity for: Var_Costcentre

I hope this helps :smiley: