How can we count the number of occurrence of a particular word in Notepad using UiPath

I want to count the occurrence of the word and just rename them by adding the number at the end of the string.
For example : THE THE THE THE should be replaced by THE1 THE2 THE3 THE4 and so on.

Hi Shaurya

You may a take a look at these methods

1 Like

Hello Shaurya,

You can try texttool method or try this lengthy method,
first take the matches in to a enumerate like this system.text.regularexpression.regex.matches(yourInputString,Yourpattern)
in here Yourpattern is anything in this case its β€œThe”
next loop through this enumerate using for each and the assign activity like str.append(indexof(item))
here item from for each loop

MyInputString would be the entire notepad file so how do I take the entire file as input?

Use Read Text file activty in uipath. It Outputs a text file in string

Could you help me with the workflow

will you already know what is the particular word that has to be checked for ?

Yes it will be known (6.3 KB)

Please try the attached xaml file :slight_smile: Hope this is the requirement.

I have attached the logic here . You can add Read text file activity in the start of the workflow.

I have tested it by just passing a string .

2 Likes (2.2 KB)

If you could tell me the error in Read Text file. Rest of the logic I have understood. Thank you once again

New (2.7 KB)

Hi ,

Please find the file attached :slight_smile: Hope this is the solution :slight_smile:

1 Like

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