Hello people,

I'm trying to collect some data stored between <body> and </body> tags inside a string.

Here's a piece of the code i'm using:

$regex = '/<body>(.*?)<\/body>/si';
	preg_match($regex, $content, $content);
	$content = $content[0];

This works perfect, except that it also includes the above mentioned tags. I would just like to grab the content in between those tags and store it.

In other words, only store the (.*?) part of the regex.

Anyone have an idea how to solve this? :)

*Sigh*

Got it. Using $content[1] does the trick :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.