XF 2.0 Find/Replace Video vBulletin Video Embeds

invictus

Active member
#1
I migrated from VB4 and have since upgraded to XF2.

I probably should have made use of this addon before upgrading to XF2 to find/replace video embeds in posts while I was still on XF1, but I overlooked this.

What is the recommended way to accomplish this in XF2? SQL query in xf_posts?

My post contents have video embeds that look like this:

[video=youtube;dKlgCk3IGBg]https://www.youtube.com/watch?v=dKlgCk3IGBg[/video]

I need to update them to look like this:

[MEDIA=youtube]dKlgCk3IGBg[/MEDIA]

Any help appreciated. I'm not good with regex queries. Thanks!
 

Chris D

XenForo developer
Staff member
#2
There are some newer versions/flavours of MySQL which might support regular expression updates but I'm not certain.

There are plans to update the post content find/replace tool to XF2 though we don't have an ETA for it right now.
 
#7
I've got this working with Xenforo 2 and Post content find / replace 2.0.1.
Warning: Don't use this if you don't know what you're doing, make a backup first, always do a test run first.

Quick find:
Code:
[video
Regular expression
Code:
/(\[video=youtube;)([a-zA-Z0-9_-]{6,11})(\]https:\/)((?:\/[\w\.\-]+)+)(\?v=)([a-zA-Z0-9_-]{6,11})(\[\/video])/
Replacement string
Code:
[media=youtube]\2[/media]
 
Last edited:
Top