How to get required values from my text file

Hi UiPath Forum, Need your’s help

I have to get MSISDN number ranges and MSRN Number ranges

output like:

input file:

text.txt (20.1 KB)

thanks
shaik

Hi!

Pull the data between MSISDN and MSRN into its own string-variable, and use a regex to extract it.

Here’s a thread regarding string manipulation:
How to manipulate a part of string: Split, Trim, Substring, Replace, Remove, Left, Right - News / Tutorials - UiPath Community Forum

And here’s a thread regarding regex
:owl: :bookmark: [CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

To get you started here’s a suggestion for a regex expression:
(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\w+)

Use regex101: build, test, and debug regex to build and test your expression.

Hi @shaik.muktharvalli1

I have attached the xaml file and the output excel please check and let me know if any changes required.

Xaml:
Sequence61.xaml (20.6 KB)

Excel:
FormTask.xlsx (7.0 KB)

Regards

Hi @vrdabberu, let me check and inform in any changes enquired.

Thanks,
shaik

1 Like

Hi @shaik.muktharvalli1 please check attached flow for your reference which is useful for you.
I have used Regex to get all values from text file. and need to add into excel. for that use write range in excel.

Regex func: System.Text.RegularExpressions.Regex.Matches(str_textfile, “\b389 \d{2} \d{6} \d{6}\b”)

MSRN.zip (8.4 KB)
Thank you!

Hi @vrdabberu, can you please fetch Network nodes global titles also

image

like … 38977,38975 and feed into output excel

thanks
shaik

You need only those two values? 38977 and 38975 and also can you please give me the column name. @shaik.muktharvalli1

Regards

Column name: NN_GT

Output like:

Thanks
shaik

HI @shaik.muktharvalli1

updated the xaml as per your requirement please check and let me know:

xaml:
Sequence.xaml (23.9 KB)

Output excel:
FormTask.xlsx (7.1 KB)

Regards

Hi @vrdabberu, Result getting correctly but some text file not getting correctly

can you check below input text file:

text.txt (44.7 KB)

thanks
shaik

Hi @shaik.muktharvalli1

The regex expressions is entirely based on the text extracted. So the text file you have placed earlier and now having different template so give me sometime and i will update you with the updated code.

Regards

ok @vrdabberu, thanks for update

thanks
shaik

Hi @shaik.muktharvalli1

I have updated the regex expressions please check now:

Xaml:
Sequence61.xaml (25.2 KB)

Output files:
text.txt (44.7 KB)
text.txt (20.1 KB)

Output Excel:
text (3).xlsx (7.9 KB)
text (2).xlsx (7.1 KB)

Regards

Hi @vrdabberu Thanks for updated code.

let me check and confirm

thanks
shaik

1 Like

Hi @vrdabberu

got one error please check below screenshot for your reference

Have you changed the text file ? @shaik.muktharvalli1

Regards

No, Running same text file…but got erroe

If text file changed, what happened ?

thanks
shaik

If you have changed the text file and if there is any change in the format then it will throw an error.

Regards

but I have running same text file , but got throw

please check

thanks
shaik

I have chacked multiple times and i didn’t faced any error and can you please tell me which file are you running I will cross check with that. @shaik.muktharvalli1

Regards