There is a text file, it is necessary to choose from it a certain number of lines, the text is always different, but there are always two known lines in advance, but the text is before them, between them and after not. Well, as an example:
Я вас любил: любовь еще, быть может, В душе моей угасла не совсем; Но пусть она вас больше не тревожит; Я не хочу печалить вас ничем. Я вас любил безмолвно, безнадежно, То робостью, то ревностью томим; Я вас любил так искренно, так нежно, Как дай вам бог любимой быть другим. :) and from this let’s let us know the lines: “But don't let it bother you anymore;” and "That shyness, then jealousy we torment;". It is necessary to take them and what is between them, the rest is unnecessary for us.
excerpt = re.search(r'(Но пусть она вас больше не тревожит.*То робостью, то ревностью томим;)'s, text).group(1)- Mikhail Vaysman