How to get specific data from a text file

Hi All,
I am new to UiPath.
I need to scrape specific data from below text file -I need the values of each field to perform validations. How can i extract only the values, the field names are constant.
for ID , I need all the 3 values separately.

Please help me.
Thanks in advance!

Name: abc-ef
ID: 1;2;3

In: 111111
Out : 22222

It’s a simple job using regex :slight_smile:
To get the name,Take a look :

1 Like

I am trying it using split function strResultString.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)
and then in for each tryng to do a substring. But someting is going wrong in the substring function

Hi, welcome to the community!
After you read the text file to a varText variable, you can do like this to a varIds String[] variable:
varIds = System.Text.RegularExpressions.Regex.Match(varText, "(?<=ID: ).*").Value.Split(";"c)
you can get every id in a for each activity.

I am getting the values after semicolon, but I can’t retrieve them separately for each field.
Please help me

ok, im taking a look. @rv27 see my file: TextFile.xaml (7.0 KB)

Thank you, will be waiting for your suggestion

didnt you see it above?

@bcorrea I saw it, Thanks!
I thought you are taking a look at my code to let me know about what i have to change.

@rv27 Modified your code and was able to extract two values. Similarly rest of the values can be extracted. Please take a look. Thanks!
Modified_TextFile.xaml (14.5 KB)

Hello rv27,
In this video I do a lot of stuff with String:

0:35 Examples for Substring functions
4:10 IndexOf and LastIndexOf
5:00 SubString working together IndexOf and LastIndexOf
6:45 Split string by character
8:50 Split string by string
12:00 Lower Case and Upper Case
12:45 Trim
15:05 Compare strings in multiple ways
19:05 Resume of all the String function part

Cristian Negulescu