XF 2.2 Find and replace unlinked Imgur images and properly wrap in Bbcode?

nodle

Well-known member
Wanting to see if someone had a solution for broken Imgur links that have no associated [IMG] image link [/IMG] to the post? They are just raw pasted links that did not get transferred to the proper Become from an old import. I was hoping to use: Xenforo Find/Replace that could search for the beginning https or http://imgur.* and then wrap [IMG] [/IMG] so that they could display properly. Is there anyway to do this properly? Thanks!
 
Could you use something like?
Code:
UPDATE xf_post SET message = REPLACE(message,'https://i.imgur.com/*','[IMG]https://i.imgur.com/*[/IMG]');

Or am I way off?
 
Post here for help
 
In case anyone every reads this in the future, i figured it out by myself:

Quick Find: https://i.imgur.com

Regular Expression: /https:\/\/i\.imgur\.com\/(.*?)\.(jpg)/i

Replacement String: [img]https://i.imgur.com/\1jpg[/img]

Change the .jpg/.png/.gif accordingly in both spots.
 
Back
Top Bottom