How to pull up a name/word from a paragraph/sentence using regex

Hi Team,

I am trying to pull out word “uiPath/UiPath/uipath/ui path” value from a sentence/paragraph.

for ex: “I am completing the UiPath course in Advanced Certification. Hello world was my first program of uipath. Ui Path is a tool used in RPA development.”

How can I able to extract UiPath word (in every format) from above paragraph and count how many times Uipath appears.

Thank you,
AK

Hi, you could try Regex.Matches(YourTextVar, “UiPath”, RegexOptions.Multiline).Count and do this for every Version and then take the sum. Maybe someone knows a direct way.

Similar to @Jizh response but you can use the matches activitiy as below:

  • Matches Activity (Input = String, Pattern = “(uipath)”, RegexOption =(IgnoreCase, Compiled).

Then simply assign result.count().tostring to your count variable

2 Likes

Hi Tim,

Thank you for the solution.

I would also like to include that this “result.count().tostring” is able run in individual sequence workflow,
but when I am unable to call “count function on Matches result” in a workflow which is invoked to other main workflow .

Could you please explain me the reason behind this. It will be a great help.

Thanks and regards,
Abhinav!:grinning:unable%20to%20call%20Count%20function%20on%20Matches%20activity%20result|690x387

@Abhinavk8

Use Matches Activity.
Input = Your String
Pattern : (Ui\s{0,}Path)
Regex Option : (IgnoreCase, Compiled)

Reason for using \s{0,}, Even though if there is space we have to consider.

Regards,
Mahesh

3 Likes

Hi Mahesh,

Thank you for the solution.
Using your code I am able to solve issue in my project.
I really appreciate your help.

Thank you,
Abhinav .

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