The pattern Shortest["A"~~__~~"B"]
is oriented : It assumes the text is read from left to right and it takes the text between the first "A" and the next "B".
Any "A" after the first "A" is considered as normal text.
I want to select a text between the last "A" and the first "B".
This problem can be solved with Except["A"], but I don't find a clean solution when "A" is a string with more than one character.
Example :
StringCases[
"blabla ...Hello Hello ... blabla ... Goodbye Goodbye ..",
Shortest["Hello" ~~ ___ ~~ "Goodbye"]
]
gives : {"Hello Hello ... blabla ... Goodbye"}
I would like : {"Hello ... blabla ... Goodbye"}
.
Edit
If there are several sequences Hello ...Goodbye (not nested), It should make a List of them.