Search word in a text and show what is before that word

Good morning,

I am doing an automation and I have to get the text from a scanned pdf and from everything obtained I need to search for a specific word and show what is before that word.

Can anybody help me please.

For example, I have a text that says “Read our forum FAQ”, I need it to bring me everything that goes before “frequent”.

Hi,

Try this logic.

str_text= “Your Text”
int_First_Occurance = str_text.IndexOf(“Data”)
Result = str_text.Substring(0,int_First_Occurance).ToString

Hi @Melanny_Herrera_Cruz

You can use the UiPath.PDF.Activities Package for this

Use Read PDF With OCR to get the text from scanned PDF. You can use Tesseract OCR or one of you choice then use substring method to extract the information that you need

Expression:

PDFExtractedText.Substring(0,PDFExtractedText.IndexOf("Your Search String?")).ToString