This question already has an answer here:
Hi i'm new to programming and it's my first question, so please go easy on me.
I want to create a function that extracts text which is between
>. For example with a string of text:
str="Random stuff here TEXT BEGIN extract this text > here is other stuff >"
The function should extract the text between
>. The text in-between, can be anything from symbols like
\n or be another string.
I know I can get every instance of
BEGIN with position,
but how do I get the position of the next instance of
BEGIN, so I can extract the text in-between? Or is there a smarter way of doing this?