Ive tried the ff regex below but it does not seem to work. I wanted to extract data between F. Prepaids and G. Initial Escrow Payment and get the ff sample result below. Thanks.
You may use
(?m)(?<=F\. Prepaids[\s\S]*?^\d+ )[^\r\n]+(?:\r?\n[^\n\d][^\r\n]*)?(?=[\s\S]*?\nG\. Initial Escrow Payment)
See the regex demo
Details
(?m)
- multiline mode on(?<=F\. Prepaids[\s\S]*?^\d+ )
- match a location immediately preceded with F. Prepaids
, then any zero or more chars as few as possible, then 1+ digits at the start of a line and then a space[^\r\n]+
- any one or more chars other than CR and LF and(?:\r?\n[^\n\d][^\r\n]*)*
- zero or more sequences of CRLF or LF ending, any non-digit and non-newline char and then any zero or more chars other than a newline and carriage return(?=[\s\S]*?\nG\. Initial Escrow Payment)
- the current location must be followed with
[\s\S]*?
- any zero or more chars as few as possible\n
- a newlineG\. Initial Escrow Payment
- a G. Initial Escrow Payment
text.