I have a text from which I want to extract text that occurs betweeen two match strings. But when I am trying to extract it using regex instead of the all the matches of that range it is extracting the last one.
Here is what I have tried
string = "\n3.5\nFerguson to Gayle, FOUR, short of length delivery on the stump, 115.9km/h, Gayle clears that leg and clubs it off the toe-end just over mid-on to the long-on fence for four\n3.4\nFerguson to Gayle, no run, yorker length delivery, inch-perfect, 148.2km/h, digs it out off the toe-end\n3.3\nFerguson to Gayle, no run, slower delivery on a good length heading for middle, Gayle delays his defence from the crease back down the wicket\n3.3\nFerguson to Gayle, wide, 148.1km/h, wide down leg, swings away after the ball crosses the batsman's missed flick and swerves to the left of the 'keeper who has done well to collect it\n3.2\n"
re.findall("3.4(.*)3.3", string, re.DOTALL)
What I want is all the matches i.e from \n3.4\nFerguson
towicket\n3.3
and the other \n3.4\nFerguson
to toe-end\n3.3
i.e both the occurence. However my code only gives me the largest one. Is there any way to do it? Any help would be highly appreciated.
Note : Please understand that what I want is all possible matched pattern however adding ? gives only the first one.