I have some content in the format:
text = """Pos no
...
... 25/gm
The Text to be
...
excluded
Pos no
...
... 46 kg
The Text to be
...
excluded
Pos no
...
... 46 xunit
End of My Text
Where,
Pos no... 25/gm
- It is a sort of tabular structure from which I have to extract the values.
The Text to be ... excluded
- This has constant start (lets say The Text to be
) but not definite end i.e excluded
might not be present.
End of My Text
-
This text will always be present.
I want a list with the tabular content only i.e.
["Pos no
...
... 25/gm",
"Pos no
...
... 46 kg",
"Pos no
...
... 46 xunit"]
Here is my try but its not fetching the right list:
re.findall(r'(Pos no .+?)(?: |The Text to be|End of My Text)', text, re.DOTALL | re.M)