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).
Thankyou
Hi @Sairam_RPA
You can use the following RegEx pattern to determine whether the exact word is specified in the text file or not.
\bword\b
In UiPath, you can do it like this:
Read the text file & keep the data in a string textFileData.
Prepare the Regex pattern like this:
regexPattern = “\b”+yoursearchword+”\b”
And then, check whether that exact word is present in the textFileData or not by using the following expression:
System.Text.RegularExpressions.Regex.IsMatch(textFileData,regexPattern).ToString
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.
@Sairam_RPA
Please find the requested workflow:
Text Finder Process.zip (15.0 KB)
Hope this helps,
Best Regards.
1 Like
system
(system)
Closed
June 17, 2023, 12:19pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.