I note you have multiple ^ characters in your regular expression - this tells me that you expect to have new lines in your string. Therefore you need to use the m and s modifiers so that ^ will match starts of lines (as opposed to the start of the string) and so . can match new lines, respectively. See perlre.
Comment on Re: extract all the text between two words