Extracting data using preg_match_all

So I used file_get_contents to download a page. I extracted a chunk of data I want, but I want to get rid of the html around the value that I’m looking for.

<title>Sewer Waste</title>

How would I pull “Sewer Waste” out of that code using preg_match_all.

if(preg_match_all( "/<title>/^[a-zA-Z][\\w\\s]*/<\\/title>/i", $card, $gtdump))
				{
					$gt = $gtdump[0][0];
				}
				else 
				{
					echo 'Cannot be retrieved.';
				}

If I remove the <title></title> from the search, I will return many results. There must be a simpler way to extract just the text inbetween the <title> tag’s?

try using lookahead or lookbehind assertions

http://us.php.net/manual/en/regexp.reference.assertions.php

Try this

$content = @file_get_contents("http://www.DOMAIN.COM/");
if ($content !== false)
{
        $pattern = '#<title>(.+?)</title>#si';
        if (preg_match($pattern, $content, $m))
        {
                $title = $m[1];
                echo $title;
        }
}

or you could just [FPHP]strip_tags[/FPHP] the result. or [FPHP]str_replace[/FPHP]… or [FPHP]substr[/FPHP]… or… or…