I am trying to extract only one portion of the string text by using regular expressions in Python with two specific matches. To be specific, here is an example text:
example = """
The forward-looking statements are made as of the date of this report,
and the Company assumes no obligation to update the forward-looking statements
or to update the reasons why actual results could differ from those projected
in the forward-looking statements. PART 1. ITEM 1. BUSINESS
General Farmers & Merchants Bancorp, Inc. (Company) is a bank holding company
incorporated under the laws of Ohio in 1985 and elected to become a financial
holding company under the Federal Reserve in 2014. Our primary subsidiary,
The Farmers & Merchants State Bank (Bank) is a community bank operating
in Northwest Ohio since 1897.ITEM 2. PROPERTIES Our principal office is located in Archbold, Ohio.
The Bank operates from the facilities at 307 North Defiance Street.
In addition, the Bank owns the property from 200 to 208 Ditto Street,
Archbold, Ohio, which it uses for Bank parking and a community mini-park area.
"""
, and I would like to extract the 'between' portion of the text starting from a start match 'ITEM 1.' and an end match 'ITEM 2.', so the final result should look like this:
final_result = """
ITEM 1. BUSINESS
General Farmers & Merchants Bancorp, Inc. (Company) is a bank holding company
incorporated under the laws of Ohio in 1985 and elected to become a financial
holding company under the Federal Reserve in 2014. Our primary subsidiary,
The Farmers & Merchants State Bank (Bank) is a community bank operating
in Northwest Ohio since 1897.
"""
As a matter of fact, the above example text is one particular example of a large collection of the similar texts, so I hope that the answer would be more or less general so that I could adapt your answer to different textual conditions that other string texts might have. Thank you in advance!