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

XF 1.1 Need a query to find and replace a something in posts

Discussion in 'XenForo Questions and Support' started by BamaStangGuy, Jul 13, 2012.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    On a recent forum I purchased the following code was used to embed videos:

    HTML:
    <iframe width="640" height="360" src="http://www.youtube.com/embed/lXgE45oA1iQ" frameborder="0" allowfullscreen></iframe>
    This won't work in xenForo so I'd like to find and replace every instance of this in all posts and convert it to the youtube video code.
     
  2. Vincent

    Vincent Well-Known Member

    BamaStangGuy likes this.
  3. BamaStangGuy

    BamaStangGuy Well-Known Member

    Thank you. Now I just need a regex for the above :)
     
  4. Vincent

    Vincent Well-Known Member

    I hope you can do that yourself because I have no idea on how to do that, sorry :(
     
  5. BamaStangGuy

    BamaStangGuy Well-Known Member

    I'll see what I can do.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Use this addon:

    http://xenforo.com/community/threads/post-content-find-replace.6548/

    Here are settings for your replacement:

    Quick Find: <iframe

    Regular expression: #<iframe width="640" height="360" src="http://www\.youtube\.com/embed/([^"]+)" frameborder="0" allowfullscreen></iframe>#siU

    Replacement String: [media=youtube]\1[/media]

    Screen shot 2012-07-14 at 2.28.02 AM.png
     

Share This Page