Regex - Extract text from between 2 strings

Hi, I have the following text. I need to extract the string between Assesment Summary and Loan details.

Blockquote

Loan Product Advisor ® Feedback Certificate
Assessment Summary

BORROWER NAME
John Freddie
NUMBER OF SUBMISSIONS
1
LP KEY NUMBER
E0051237

Assessment Summary
PURCHASE ELIGIBILITY
RISK CLASS
Representation & Warranty Relief
COLLATERAL R&W* RELIEF
INCOME R&W* RELIEF
ASSET R&W* RELIEF

ELIGIBLE ACCEPT NOT ELIGIBLE N/A NOT ELIGIBLE NOT ELIGIBLE

Loan Details

Blockquote

I need the last line :


From that I need to extract the first 2 words ELIGIBLE and ACCEPT.

Any help will be appreciated.
Thanks.

Hi @chauhan.rachita30,

Just to double confirm from the entire above text you need only these two words ELIGIBLE ACCEPT?

Thanks

Maybe you can combine Regex with String Methods / LINQ filterings


Find the line

then extract the words e.g. with regex:
grafik

1 Like

yes, but the text is from a PDF, and for future I want to extract the text between those 2 strings(assessment summary and loan details) if PDF structure changes.

sample for the Block extraction:

can you write it as text? Thanks.

arrLines = strText.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
arrLines.toList.FindIndex(Function (x) x.trim.toUpper.StartsWith("LOAN DETAILS"))
(?<=Assessment Summary)[\s\S]*?(?=Loan Details)
1 Like

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