1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP preg replace NEED HELP $5

Discussion in 'Hire a Freelancer' started by baokyrox, Nov 6, 2011.

  1. baokyrox

    baokyrox BANNED BANNED

    Joined:
    Oct 10, 2008
    Messages:
    429
    Likes Received:
    34
    Code:
    <iframe src="http://www.zshare.net/videoplayer/player.php?SID=dl084&FID=95738629&FN=elementhunters38-lq_001.mp4.flv&iframewidth=642&iframeheight=419&width=640&height=385&H=95738629e1effeeb&ISL=1" height="419" width="642" border=0 frameborder=0 scrolling=no id="videoframe" name="videoframe"></iframe>
    
    I need help to preg replace the following
    iframewidth=642&iframeheight=419&width=640&height=385

    to
    iframewidth=520&iframeheight=414&width=500&height=380 (no spacing, sorry don't know why my post show spacing)

    Take note that the following value for iframewidth,iframeheight,width & height change so i need preg replace with them can be any value

    i also need preg replace

    height="419" width="642" to height="414" width="520"

    Also that 419 and 642, this 2 values can be anything, so need expression also..

    Payment : $5 usd
    Mode: Paypal

    pm me the solution & your paypal details.
     
    Last edited: Nov 6, 2011
  2. wkrappen91

    wkrappen91 Power Member

    Joined:
    Sep 9, 2010
    Messages:
    588
    Likes Received:
    720
    Location:
    127.0.0.1
    Why not parse the values out and just join them again with the right numbers?
    Like:
    $regex="/<iframe(.+?)iframewidth/";
    preg_match($regex,$text,$match);
    echo $match[0]."520";

    This is only the first part, but it will parse out the stuff before the first number, and change that number to a 520 (not tested tho, just an example).