I have a regular expression which I want to write all of the text between two headings. I don\'t understand why it is simply writing an empty string to a file in another direct