The .
by default doesn't include new lines so your current regex doesn't match.
re.DOTALL
Make the '.' special character match any character at all, including a newline; without this flag, '.' will match anything except a newline.
This doc has a list of modifiers that can be used to alter how the regex functions https://docs.python.org/2/library/re.html#re.S.
So the .+?
only matches the following without the modifier:
<p class="body">
with the modifier you will get:
<p class="body">
Giving the meeting of NITI Aayog in New Delhi a miss, West Bengal Chief Minister and Trinamool Congress chairperson Mamata Banerjee said in Bardhaman on Wednesday that the Centre should withdraw the land acquisition ordinance.
</p>
You should consider using a parser for this though. This regex will fail with any additional elements in your search string, for example:
<p class="body">
Giving the meeting of <em>ITI</em> Aayog in New Delhi a miss, West Bengal Chief Minister and Trinamool Congress chairperson Mamata Banerjee said in Bardhaman on Wednesday that the Centre should withdraw the land acquisition ordinance.
</p>
You can see this in action here.
(.+?)
",text) – chandan sr Jul 15 '15 at 16:03\n (.+?)\n
""",str(each),re.X) – chandan sr Jul 15 '15 at 16:26