MySQL Find and Replace with a twist

Discussion in 'Programming' started by mercuryyy, Oct 19, 2008.

  1. #1
    I'm in a bit of a jam here.

    I got over 6000 videos that are embeded into post's in a wordpress database.

    I'm looking for a dynamic way to change this:
    <p><embed src="http://www.veoh.com/veohplayer.swf?permalinkId=v161810549Y9PB9nF&id=16071029&player=videodetailsembedded&videoAutoPlay=0" allowFullScreen="true" width="540" height="438" bgcolor="#FFFFFF" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></p>

    Into this:
    <p><IFRAME border=0 marginWidth=0 marginHeight=0 src="http://www.watchanimeon.com/veoh.php?id=v161810549Y9PB9nF" frameBorder=0 scrolling=no width="510" height="414"></iframe></p>

    When the Red text is dynamic and difrent on each post and needs to be included in each find and replace string. I could have done it myself if this was the case but the blue text u see is also dynamic but does not need to be replced only deleted, So this rules out a lot of Mysql simply search and replace code.

    Any ideas are highly welcome.


    Thanks a lot.

    Izzy
     
    mercuryyy, Oct 19, 2008 IP
  2. logylaps

    logylaps Active Member

    Messages:
    761
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    85
    #2
    logylaps, Oct 19, 2008 IP
  3. mercuryyy

    mercuryyy Well-Known Member

    Messages:
    658
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Hi logylaps thanks for the tip

    can u provide me with more info on how to do the following using regexp.


    Thanks,

    Izzy
     
    mercuryyy, Oct 19, 2008 IP
  4. logylaps

    logylaps Active Member

    Messages:
    761
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    85
    #4
    Are you using just sql or php or some other programming lang for this?
     
    logylaps, Oct 20, 2008 IP
  5. mercuryyy

    mercuryyy Well-Known Member

    Messages:
    658
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #5
    It's simply MYSQL.

    As i said i'm using Wordpress
     
    mercuryyy, Oct 20, 2008 IP
  6. MrMarvin

    MrMarvin Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    With a good regexp, you would use the video ID as a maker and find the first <p> before it, and after it. Then replace all of that with the new code.

    It would only work, if the ID is only used once.

    I notice your video sizes aren't the same, ie 540x438 vs 510x414, why?
     
    MrMarvin, Oct 23, 2008 IP