How to get a whole string between two words?

I have an ExtracDataPDF variable with all the information of a pdf,

How to obtain or cut all the information of this variable that is between 2 specific words?

Best Regards

welcome to the forum

give a try on regex

with more details on your case and sample data we can adress it more on details e.g. line breaks between the two words

Right now I get the information as follows: ExtracDataPDF.Substring (ExtracDataPDF.IndexOf (“ORDER NO:”) + “ORDER NO:”. Length) .Split (Environment.NewLine.ToCharArray) (0)

but I get the information cut off, I would like to obtain it with something like this: ExtracDataPDF.Substring (ExtracDataPDF.IndexOf (“TEL:”) + “TEL:”. Length) .Split (“NAME:”, “PRODUCT:”) [1] ; but this expression is invalid, I attach the pdf of reference.

we can better react on clear input samples along with a description on expected output. About regex also have a look here (kindly note the mentioned SOP)

1 Like

I don’t get results = (


done with regex101:
Regexstorm also is recommendable: .NET Regex Tester - Regex Storm