I have a template that I need to replace a part of that using Regex in Python. Here is my template: (Note that there is at least a new line between two comments)
hello
how's everything
<!--POSTS:START-->
some text
<!--POSTS:END-->
Some code here
I want to replace everything between <!--POSTS:START--> and <!--POSTS:END--> in Python. So I made <!--POSTS:START-->\n([^;]*)\n<!--POSTS:END--> pattern but it includes <!--POSTS:START--> and <!--POSTS:END--> too.
Here is what I want:
re.sub('...', 'foo', message)
# expected result:
hello
how's everything
<!--POSTS:START-->
foo
<!--POSTS:END-->
Some code here
Thanks.