I am trying to replace the height and width on an html iframe src upon being saved to a database. I have looked at the preg_replace function and PCRE expressions but can't work it out. Listed below is my code and sample input
$pattern1 = '/width="[0-9]*"/';
$pattern2 = '/height="[0-9]*"/';
$subject = '<iframe src="http://player.vimeo.com/?title=0&byline=0&portrait=0" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
$returnValue = $preg_replace(array($pattern1, $pattern2), array('width="200"','height="200"'), $subject);
Any help would be much appreciated!
Cheers folks!