Jump to content

Regular Exp Help


tobeyt23

Recommended Posts

sorry basically im taking the you tube embed code which someone else is adding to our db. So i want to change the height and with which i am doing with:

 

$vid            = '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/zMQ6LfyA-0o?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zMQ6LfyA-0o?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>';
$search         = array('<embed', '></embed>');
$replace        = array('<param name="wmode" value="transparent" /><embed', ' wmode="transparent"></embed>');
$find           = array('/height(=)(".*?")/', '/width(=)(".*?")/');
$replacement    = array('height="175"', 'width="200"');

$vid = str_replace($search, $replace, $vid);
$vid = preg_replace($find, $replacement, $vid);

 

I also need to then see if the rel=0 is added to the value="" and add it if not

Link to comment
https://forums.phpfreaks.com/topic/213062-regular-exp-help/#findComment-1109625
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.