How can I grab the entire content inside `<body>` tag with regex?

Viewed 18353

How can I grab the entire content inside <body> tag with regex?

For instance,

<html><body><p><a href="#">xx</a></p>

<p><a href="#">xx</a></p></body></html> 

I want to return this only,

<p><a href="#">xx</a></p>

<p><a href="#">xx</a></p>

Or any other better ideas? maybe DOM but I have to use saveHTML(); then it will return doctype and body tag...

HTML Purifier is a pain to use so I decide not to use it. I thought regex could be the next best option for my disaster.

2 Answers
Related