I'm trying to use regular expressions in PHP to filter a large string ($content
) and save all iFrame code (from begining to end <iframe ... </iframe
) to an array. I have tried the following with no success.
preg_match_all('#<iframe([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', $content, $matches, PREG_OFFSET_CAPTURE);
$video1 = $matches[1][0];
var_dump($video1);
With this I am only able to return one video. I am no expert on regex but feel this should be relatively simple to do.