Search for a text in filename

Hi, I am new to UiPath. I am trying to scrape all the text from pdf using ‘get ocr text’(which i did) then search for a particular word in the text file then print out the next few lines after the searched word. I tried using ‘ocr text exists’ but its not accurate and ‘find ocr text’ but there’s an error thrown saying activity timeout exceeded even after i changed ‘Wait For Ready’ to NONE.

pLS do advise on wat i can do about this.

Thank you xoxo

what is the problem in this approach ? Is this also not working ?

@skini76 Hey maybe i wasn’t clear sorry. My question is how to search for a particular word in text file then print out the next few lines after the searched word?

My assumption is get ocr text is working properly, once you get the text in a variable you can get the desired results using string functions like search, substring etc… Will this work for you ?

@skini76 my ‘get ocr text’ is workinng properly. It gets all the text from pdf into the variable. But how to search a word in it? I don’t have any ‘search’ activity, do i have to install some package for it ?

There are many string functions provided by UiPath, I suggest you refer the tutorial once for this.

image

@skini76 Oh i see, thank you. However, in the assign, text1 = j.Substring(“h-CLOUD NO S12345-AB”). There is a validation error 'option strict on disallows implicit conversions from string to integer. I cannot change ‘j’ variable’s type argument to string as after extracting from pdf it has numbers and characters

what is the data type of text1 and j ? Both of them should be string.