Resource icon

Post Content Find / Replace 2.0.1

No permission to download
I converted an old VB into XF. The old VB has external Links http/domainOLD/data/1.pdf, http/domainOLD/data/XYZ.doc etc.

Can I use this tool to replace only one part of the old URL like https://domainNEW/data/ ??

I need a regular exp. for that.
 
I converted an old VB into XF. The old VB has external Links http/domainOLD/data/1.pdf, http/domainOLD/data/XYZ.doc etc.

Can I use this tool to replace only one part of the old URL like https://domainNEW/data/ ??

I need a regular exp. for that.

Quick find:
Code:
http://domainOLD.com

Regular Expression:
Code:
#http:\/\/domainOLD\.com\/data\/([^\s]+)#siU

Replace:
Code:
https://domainNEW.com/data/\1
 
I am trying to clean up some bbcode from a vbulletin => xenforo import. Looks like there may be nesting issues?

I am using:

Quick find: [STRIKE

Regular expression: #\[STRIKE](.*)\[/STRIKE]#

Replacement string: [s ]\1[ /s]

here is the original:

Code:
[STRIKE][COLOR=#333333]Not [/STRIKE] [/COLOR][COLOR=#ff0000]Each [/COLOR]one [STRIKE]more[/STRIKE]

here is what it is changing it to:

Code:
[s][COLOR=#333333]Not [/STRIKE] [/COLOR][COLOR=#ff0000]Each [/COLOR]one [STRIKE]more[/s]

I am using (.*)\ since there are line breaks within strike bbcode

Thanks!
 
If you are just looking to replace strike with s then I would go with a simple query run against the DB.

SQL:
UPDATE xf_post SET message = REPLACE(message, 'STRIKE]', 's]');

That should catch all opening and closing instances of it.
 
If you are just looking to replace strike with s then I would go with a simple query run against the DB.

SQL:
UPDATE xf_post SET message = REPLACE(message, 'STRIKE]', 's]');

That should catch all opening and closing instances of it.
Awesome! Thank you Brogan

Worked perfectly!
 
Yes. Usually safe to assume any official add-ons will work with 2.2 if they worked with 2.1 or 2.0 even if not explicitly stated.
 
I am running XF v2.2.2

I want to replace old imported youtube links [URL]https://www.youtube.com/watch?v=u9Dg-g7t2l4[/URL]

Quick Find: [URL]https://www.youtube.com/watch?v=
Regular expression: \[URL\]https:\/\/www.youtube.com\/watch\?v=([\w\-]+?)\[\/URL]
Replacement string: [MEDIA=youtube]$1[/MEDIA]

I receive this error:

FR Error.webp

Any help would be greatly appreciated.
Thank you!
 
Okay, I think I found the ultimate solution for anyone with [URL] youtube.com [/URL] and [URL] youtu.be [/URL] links....
It comes from this post : Replace URL Youtube Links

And the summary is:

Quick Find:
Code:
[url


Regular expression:
Code:
#(\[url(?:]|[^]]+]))http(?:s)?://(?:www\.)?(?:[a-z0-9-]+\.)?youtu(?:be\.com/(?:[a-z]+(?:/api/videos/)?)|\.be)(?:\?v=|/)?([a-z0-9_-]{11})(?:[^\s[]+)?(\[/url])#siu


Replacement String:
Code:
[MEDIA=youtube]\2[/MEDIA]

The result is pretty awesome.

1 youtube.JPG2 youtube.JPG
 
Nice, this one found 63 that I had not found with all my various iterations after a manual conversion of my local forum when I converted from DNN (DotNetNuke) back in April 2015. Thanks!!!
 
Can anyone help with a regex? And let me know what fields to use in the add-on? Thanks!

This will be a post-import change coming from IPB and this is their share attachment code. I need to change these

[sharedmedia=core:attachments:1234]

to these

[ATTACH]1234[/ATTACH]

respectively (number-wise).

And yes attach code works the same, I tested it in posts they were not authored in.

Thanks if you can help!
 
ErrorException: [E_WARNING] preg_match_all(): Empty regular expression in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
  1. XF::handlePhpError()
  2. preg_match_all() in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
  3. XFPR\Admin\Controller\PostReplace->actionReplace() in src/XF/Mvc/Dispatcher.php at line 350
  4. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
  5. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
  6. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
  7. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2326
  8. XF\App->run() in src/XF.php at line 488
  9. XF::runApp() in admin.php at line 13
We haven't used this add-on for ages, so just updated to the very latest version but come across this error.

All I'm trying to do is search for "vin998" and replace with "vin499"

I think it's because I'm not putting in a 'regular expression'. Can anyone help as to what that should be?

Any ideas?
 
Last edited:
We haven't used this add-on for ages, so just updated to the very latest version but come across this error.

All I'm trying to do is search for "vin998" and replace with "vin499"

I think it's because I'm not putting in a 'regular expression'. Can anyone help as to what that should be?

Any ideas?
Try this database query suggested above. Dont forget to replace the find and replace keywords.
Code:
UPDATE xf_post SET message = REPLACE(message, 'STRIKE]', 's]');
 
Hi All,

Trying to figure out a regex that will let me fix unescaped URL bbcodes.

Example:

Code:
There are so many TV show will issue the new season in the new year,but not sure these ones such as [url=http://www.dvdsetpro.com]Charemed[/url]
 [url=http://www.dvdsetpro.com] Buffy The Vampire Slayer [/url]
[url=http://www.dvdsetpro.com The Sopranos [/url]

I want to replace this:
Code:
 [url=http://www.dvdsetpro.com The Sopranos [/url]
with this:
Code:
[url=http://www.dvdsetpro.com] The Sopranos [/url]
 
Top Bottom