Using regex in python, I want to find a regex pattern and make the pattern a reference point for the text that follows. Then when the pattern is found again, it begins another record with the second-found-pattern as a reference point for everything that follows until the next pattern and its records.
I have been studying search, findall, and match, and group(), but I can't seem to find out how to do this. I know this isn't a perfect question, but I'm a noob. Thanks for any direction.
Here is an example of desired output:
<document>
Pattern stuff stuff stuff
Stuff thing
Stuff
Stuff stuff stuff stuff thing
Pattern stuff stuff stuff stuff stuff stuff
Pattern stuff stuff thing stuff
Pattern stuf thing
<\document>
Desired output:
Pattern[0] stuff ...
Pattern[1] stuff ...
Pattern[2] stuff...
Another desired output:
Pattern[0] thing ...
Pattern[1] thing ...
Pattern[2] thing...
Aucun commentaire:
Enregistrer un commentaire