I’ve small preg_replace problem. I need to resize iframe code output so I’m using preg_replace, regex seems to work fine, but result is same as input no changes. Here code I’m using:
$video_code = preg_replace( '/width="(.*?)"/', 'width="'.$width.'"', $video_code );
$video_code = preg_replace( '/height="(.*?)"/', 'height="'.$height.'"', $video_code );
This iframe that $video_code contains:
<iframe class='sproutvideo-player' type='text/html' src='http://videos.sproutvideo.com/embed/189bd8b4191ee1c390/d0dc5859e1d409ed?type=hd®ularColors0=666565®ularColors1=595756&hoverColors0=ed2409&hoverColors1=d1390f&highlightColors1=c9c3c9&noBigPlay=true' width='768' height='432' frameborder='0'></iframe>
Any idea why is this happening?
Thanks
George
Try this:
Escaped some characters and you’re replacing everything inbetween the
(), so the textheight=in the replacement pattern is unnecessary.