I need to find all strings that occur between the words "Close" and "Minor", for example, but the words "Close" and "Minor" occur many times in my string. How can I use regex to find all of the strings between each instance of "Close" and "Minor". Example:
In the text
$string = "Minor fall major fifth Close to home Minors cannot vote before 18 Polls Close at 8";
I want to match
fall major fifth
and
s cannot vote before 18 Polls
I have tried to use this:
my @matches = $string =~ /Minor(.*) Close/gi;
but this matches
Minor fall major fifth Close to home Minors cannot vote before 18 Polls Close
which matches the words themselves, and does not produce the desired match.
I'm so lost!