I am trying to split a piece of text in a file formatted like this:
module
some text
endmodule
module
some other text
endmodule
between the words module and endmodule and still include module and endmodule in the output string.
This is not a duplicate of other regex questions because I am trying to use re.split() to return a list, not find.
This is the regex I've tried
s=file.read()
l=re.split("module(.*)endmodule",s)
but it won't split anything...
Ideally final output would be a list that includes both modules as strings,
['module\n sometext\n endmodule', 'module\n someothertext\n endmodule']