Regex to check if a specific word exists in text

I have a text file. I want to check if specific words exist in the text file.

For example: lion, tiger, bear, alpacha etc. I only want to look at the individual words and not some words inside a string eg : “lioness” (when we search for lion, this should not be picked).


Hi @Sairam_RPA

You can use the following RegEx pattern to determine whether the exact word is specified in the text file or not.


In UiPath, you can do it like this:

  1. Read the text file & keep the data in a string textFileData.

  2. Prepare the Regex pattern like this:

regexPattern = “\b”+yoursearchword+”\b”

  1. And then, check whether that exact word is present in the textFileData or not by using the following expression:


This will return a boolean output. If the match is found, the output will be True & vice versa.

Hope this helps,
Best Regards.

Can you add this to a workflow and share.


Please find the requested workflow:

Text Finder (15.0 KB)

Hope this helps,
Best Regards.

1 Like

Hi @Sairam_RPA

Hope it helps!!

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