Resource icon

Post Content Find / Replace 1.0.0

No permission to download
Excellent! Thank you very much! I was able to use your lead to also modify a couple of other similar replacements I needed to make. Thanks again for the quick response!
 
...
Scroll down to what is now line (47) then find and highlight all of the following:
PHP:
                    $dw->setExistingData($post, true);

                    $dw->set('message', $message);
replace with the following:
PHP:
                    $dw->setExistingData($post, true);
                    if($input['silent']) { $dw->set('last_edit_date', 0);  }
                    $dw->set('message', $message);

...​

I'm having problems with the silent edit check box. When checked I still get Last edited by a moderator: 3 minutes ago on each message.

I made sure I did the replacement quoted above. Perhaps it's a permission issue for my admin account?
 
Fred, I know very little about regex expressions, but this seems to work:

Quickfind: https://example.com/register.php

Regular expression:
Code:
#https://example.com/register.php#siu

Replacement String:
Code:
https://example.com/login

You could also just run this query in phpmyadmin
Code:
UPDATE xf_post SET message = REPLACE(message, 'https://example.com/register.php', 'https://example.com/login');

None of this has been tested, so be sure to backup your database first.
 
This looked promising but I do not understand regular expressions. Isn't there a query that can just find and replace strings in the post table? If possible with multiple string replacement.

This is what I need:

Code:
FIND & REPLACE IN XENFORO DATABASE POST TABEL:

[IMG]http://forum.mydomain.com/images/rating/star1.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star2.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star3.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star4.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star5.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star6.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star7.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star8.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star9.png[/IMG]
[IMG]http://forum.mydomain.com/images/rating/star10.png[/IMG]

REPLACE WITH:

[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star1.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star2.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star3.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star4.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star5.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star6.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star7.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star8.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star9.png[/IMG]
[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/star10.png[/IMG]
 
Last edited:
You might be able to use
Code:
UPDATE xf_post SET message = REPLACE(message, '[IMG]http://forum.mydomain.com/images/rating/', '[IMG]http://forum.mydomain.nl/styles/default/mydomain.nl/review_rating/');

Be sure to back up your database first incase I'm wrong.
 
Does anybody have a list of replacements to run to convert most vb3.8 urls in posts to xenforo urls? How about vb4 urls to xenforo urls?

For example:
Convert this style of link
Code:
www.example.com/forum/showthread.php?t=4596
to
Code:
http://www.example.com/threads/4596/

And this
Code:
http://www.example.com/forum/profile.php?do=editoptions
to
Code:
http://www.example.com/account/preferences

I don't really have a problem figuring out most of the regex for these simple conversions (and some might be easier with a query), but a list of things to replace would save a lot of time.
 
Last edited:
Ok - I'm tried searching for this in this thread and have come up short.

Can anyone help me

FIND: [MENTION=5405]Todd[/MENTION]
REPLACE: @Todd

(no link or anything, just the text)

Thanks!
Todd
 
Does anybody have a list of replacements to run to convert most vb3.8 urls in posts to xenforo urls? How about vb4 urls to xenforo urls?

For example:
Convert this style of link
Code:
www.example.com/forum/showthread.php?t=4596
to
Code:
http://www.example.com/threads/4596/

And this
Code:
http://www.example.com/forum/profile.php?do=editoptions
to
Code:
http://www.example.com/account/preferences

I don't really have a problem figuring out most of the regex for these simple conversions (and some might be easier with a query), but a list of things to replace would save a lot of time.

For the first one u can use:
QF:
Code:
http://www.example.com/forum/showthread.php?t=
Regex:
Code:
#http://www.example.com/forum/showthread.php\?t=([0-9]+)#siu
Replace:
Code:
http://www.example.com/threads/\1

The second one is straight forward. U can figure that one out yourself. :)
 
For a mistake, there are too many of this in posts in my site:
Code:
[]
and also:
Code:
[manba- cheshmak]
How to replace them with a space?

Thanks
 
I've been trying for a couple of hours to try and fix some old content I've found on my site, but seems my regex building is just not strong enough and/or I'm not grasping it properly.
I'm trying to change;
Code:
[URL='http://[media=youtube]-wBH6HXidO4[/media]'][media=youtube]-wBH6HXidO4[/media][/URL]
into
Code:
[media=youtube]-wBH6HXidO4[/media]
Could anyone assist with the correct regex please?
 
I've been trying for a couple of hours to try and fix some old content I've found on my site, but seems my regex building is just not strong enough and/or I'm not grasping it properly.
I'm trying to change;
Code:
[URL='http://[media=youtube]-wBH6HXidO4[/media]'][media=youtube]-wBH6HXidO4[/media][/URL]
into
Code:
[media=youtube]-wBH6HXidO4[/media]
Could anyone assist with the correct regex please?

Try this (untested as of yet)

Quick Find:
Code:
[media=youtube]

Regular expression:
Code:
#\[URL='http://(\[media=youtube][a-z0-9_-]{11}\[/media])']\1\[/url]#siu

Replacement String:
Code:
\1
 
I'm going to call out user error here or whatever this is... now that I have tested both your examples with the one expression/replacement and well...you can see for yourself.

dfgfdgd.webp
 
I'm going to call out user error here or whatever this is... now that I have tested both your examples with the one expression/replacement and well...you can see for yourself.
Thanks, appreciate the assistance.
What tool are you using for that testing? I cannot replicate ...

1/ Using https://xenforo.com/community/resources/post-content-find-replace.1549/ No matches found (after clicking Proceed) ...
Screen Shot 2016-04-07 at 07.35.25.webp

2/ Using http://regexr.com/ ...
Screen Shot 2016-04-07 at 07.51.07.webp

3/ Using http://www.regextester.com/ ...
Screen Shot 2016-04-07 at 07.53.20.webp
 
change the quick search (in post replacement tool) to youtube and see what it nets you, though you shouldn't need to do this...

dsafsdf.webp

Note that those regex testers you have shown seem to force different delimiters on you...with / being a delimiter all / characters will need to be escaped in that expression and it is why I use my own tool modeled after another site I saw back in the day because I have full control and write regex like I would in np++.
 
change the quick search (in post replacement tool) to youtube and see what it nets you, though you shouldn't need to do this...
Didn't help, unfortunately.
Your screenshot of this add-on is different than mine. I don't have either of the 'Quick Find ...' options, or the 'Edit Silently' option. Do these only appear when you have matching/results? Maybe I have a older version, and that is the reason for our differences?
Thanks.
 
Back
Top Bottom