How to fetch "xyz" characters <Body>xyz</Body>

I have a file in which I have Body tag. It contains large amount of data. How do I fetch the data between those tags?

Hi @Deepak_M,

You could use regex to do this! See example below of the regex, as well as how it appears in UiPath:

Obviously this is quite rough, and could be refined a bit more nicely (such as using variables for input string, regex string or using .Matches instead if there is more than one body). Use a Write Line to test the output to confirm it is what you want.

Let me know how you go! :slight_smile:

Can you please share your workflow?

This is my sample code. Iwant to fetch data from “reportBytes” tag.


You can use Deserialize XML Activity to do this. Please check below thread for your reference.


I am unable to find my root. Can you please tell me in my case what is root element?

@Deepak_M sure here you go:Regextest.xaml (4.5 KB)
You would just need to replace the “Body” tags in the regex to “reportBytes”.
Let me know if you encounter any issues :slight_smile:

1 Like

Thank you very much @mcicca. You are a savior.
Thank you @lakshman. I got output with regex.


No problems glad I could help @Deepak_M! Do you mind marking my first reply as the solution to your issue? This should help others that come across the same problem to find an answer more easily.

Cheers :slight_smile:

When you are fetching data from mail use the regular expressions

regex.Replace(variableName, “<.*?>”, string.Empty)


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