Find exact word in a file

I have a list of words that was given to me in an excel. I need to iterate through them and each word needs to be used as a search word in a PDF file that I have. My process works fine however, it pulls in words that have the search word in it.

EX: search word: media
search results: immediately

I want it to only find the words media and ignore any other examples where the word is part of or embedded in another larger word.

Here is an example of my results:

and here is my .xaml
Main.xaml (27.7 KB)

@atarantino Instead of Reading row by row after reading excel follow below steps.
1.Convert Excel Datatable to String (Use OutPut data table activity)
2.After converting apply regex to string output table activity.
3.Count number of matched words

I don’t want to count matches i want to return a certain amount of characters before and after the word.

@atarantino

Ideally if you want only the exact match…I believe currently you are using contains…instead try using regex match

System.Text.RegularExpressions.Regex.IsMatch(FullStringstr,"\b" + wordToSearch + "\b")

This returns if there is exact match or not…and instead od IsMatch if we use match we get the first match…if needed all matches then can use Matches

This is how it works

cheers

I get this error -
image

i used this

System.Text.RegularExpressions.Regex.Matches(PDFOutput, “\b” + CurrentRow + “\b”)

@atarantino

  1. Go to imports and ass system.text.regularExpressions in it…imports is at the bottom of your studio beside arguments
  2. Instead of currentRow use currentRow("ColumnName").ToString …you cannot give row…you need to give a single value in the row which you want to search can be like currentRow("Word").ToString

Cheers

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