I used preg_match to do it.
In my case, I had a string containing exactly one <img>
tag (and no other markup) that I got from Wordpress and I was trying to get the src
attribute so I could run it through timthumb.
// get the featured image
$image = get_the_post_thumbnail($photos[$i]->ID);
// get the src for that image
$pattern = '/src="([^"]*)"/';
preg_match($pattern, $image, $matches);
$src = $matches[1];
unset($matches);
In the pattern to grab the title or the alt, you could simply use $pattern = '/title="([^"]*)"/';
to grab the title or $pattern = '/title="([^"]*)"/';
to grab the alt. Sadly, my regex isn't good enough to grab all three (alt/title/src) with one pass though.