Extracting sentence with set word in it

Hi @Short ,

We could try by Reading the PDF file using Read PDF Text Activity (Mostly PreserveFormat property enabled), then we can split the text based on new line.

textArray = Split(pdfText,Environment.NewLine).ToArray

Here, textArray is a variable of type Array of String.

Next, we perform the word search and grab the entire sentence like below :

foundSentences = textArray.Where(Function(x)x.tolower.Contains("yourWordToSearch")).ToArray

Here, foundSentences is also an Array of String type variable which should contain your matching sentences.

Check if the above method applies and is satisfying your requirement. Also toggle PreserveFormat property and check the result if it doesn’t work with enabled.

1 Like