So, I'm basically trying to match anything inside (and including) object tags, with this:
<?php preg_match_all('/<object(.*)<\/object>/', $blah, $blahBlah); ?>
It finds a match for this:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=9048799&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="250" src="http://vimeo.com/moogaloop.swf?clip_id=9048799&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
But it won't match this:
<object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5630744&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5630744&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
Any idea why? Thanks for any insight.
ETA: Since my approach may have been faulty to begin with, here's some background on what I'm trying to do.
This is for a Wordpress site. I am using a plugin that converts a shorttag into a full video embed code. The plugin was recently (thankfully) updated to make the code more valid.
The function I am trying to create is simply to find the first video object in a post, and grab it for use elsewhere on the site.
Here is the entire function (some of it will only make sense if you've worked with Wordpress):
<?php
function catch_that_video() {
global $post, $posts;
$the_video = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<object(.*)<\/object>/', $post->post_content, $vid_matches);
$the_video = $vid_matches [1] [0];
if(empty($the_video)){ $the_video = 0; }
return $the_video;
}
?>