Resource icon

Post Content Find / Replace 1.0.0

No permission to download
I realize this is old, but I'm hoping to get some assistance. I performed an import from PHPBB, into XF 1.5. This means I can still install this add-on, and it looks like just what I need to clean some stuff up.

So here's an example post after the import:



<QUOTE author="TO SUMMARIZE"><s>[quote="TO SUMMARIZE"]</s><COLOR color="red"><s>[color=red]</s><B><s>[b]</s>MAX HEIGHT: 200 Pixels<br/>
MAX WIDTH: 500 Pixels<br/>
MAX SIZE: 100Kb<e>[/b]</e></B><e>[/color]</e></COLOR><e>[/quote]</e></QUOTE>

I did a bunch of UPDATE statements in the database, and cleaned up a ton already, but I'm stumped about the regex to remove all colors and quotes (as you can see, there are XF BBCode tags already, so all left to do is to remove the old tags altogether).

I tried various things, and think I have what I need. Could someone confirm if this gets rid of any color tag, regardless of what color selection is between the double quotes?

(<COLOR color=\")([^\s]+\"\>)

This won't work for the QUOTE bit though, due to the whitespace in there. How would address that, and allow for any amount of words between those double quotes?

Thanks :)
 
Same.

SQL:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');

1.) is this case sensitive? I have to replace a case sensitive content. thank you!

2.) Can you modify the sql query to find and replace on posts older than 1month only?
 
I would like to replace: (post: variable)
Code:
[quote="[USER=1]@zzz[/USER], post: 123"]

with:
Code:
[QUOTE="zzz, post: 123, member: 1"]

Does anyone have an idea how?

* * * Edit: Problem solved * * *

Regular expression: #\[quote="\[USER=([0-9]+)]@zzz\[/USER], post: ([0-9]+)"]#siU

Replacement string: [QUOTE="zzz, post: \2, member: 111"]
 
Last edited:
I'm dealing with a photography forum that has been around a number of years with its origins dating back to several smaller forums that were merged together. Over the years there was vBulletin, XF, and possibly other stuff in the mix. At some point in its history it looks like linked images were converted to being inline local attached images (likely through one of the add-ons like Convert Image from AndyB). Unfortunately either the addon or the merging of forums or the migration of vB to XF or something else has left some of the posts displaying raw HTML.

Live Sample: https://cameraderie.org/threads/the-inevitable-cat-thread.40217/#post-274921

Attached is an image of how it looks for anybody who doesn't want to click-through to the example.

Here's a snippy of the sample post showing the ATTACH BB Code in the middle of the original raw HTML link.
Code:
Romeo:
<a href="http://www.flickr.com/photos/franxblank/8403731690/" title="romeo1 di franxblank, su Flickr">[ATTACH type="full"]154084[/ATTACH]"500" height="376" alt="romeo1"></a>
and Sutica:
<a href="http://www.flickr.com/photos/franxblank/8419996889/" title="I taw I taw a putty tat.. di franxblank, su Flickr">[ATTACH type="full"]154085[/ATTACH]"500" height="375" alt="I taw I taw a putty tat.."></a>

With all of that in mind then, would I be able to clean up something like <a href="http://www.flickr.com/photos/franxblank/8403731690/" title="romeo1 di franxblank, su Flickr">[ATTACH type="full"]154084[/ATTACH]"500" height="376" alt="romeo1"></a>
... to be just [ATTACH type="full"]154084[/ATTACH]?
 

Attachments

  • 1555691132653.webp
    1555691132653.webp
    30.3 KB · Views: 2
@Kier, would it be possible to get this addon updated with an "Only first post / original post"-filter, which would exclude any post that is not the first post in a thread?

I was looking at the addon source, but since my knowledge of PHP is not the best, and I don't know the SQL schema for Xenforo posts/threads, I don't dare to extend it myself :D
 
Rather than ping the addon author, you should link to the addon if anything.
Code:
doublepost
it looks like it uses timestamps so
Code:
#\[(doublepost)=[0-9]{10}]\[/\1]#siu
Thank you. It works if doublepost use one timestamp.
But in our forum, i see like these tags (two timestamp i though)

[doublepost=1550477844,1550401979][/doublepost]

So, how can i delete them instead of your code.
 
You are welcome.

This will match an unlimited amount of timestamps.

Code:
#\[(doublepost)=(?:(?:[0-9]{10})(?:,)?)*]\[/\1]#siu
 
You are welcome.

This will match an unlimited amount of timestamps.

Code:
#\[(doublepost)=(?:(?:[0-9]{10})(?:,)?)*]\[/\1]#siu
Thank you again.

And can you please help me about that required regex for me also?

I moved the our board from subfolder to subdomain; so i need change all url's which posted on forum.

Old URL's: https://www.domain.com/forum/xxxx/
New URL's: https://forum.domain.com/xxx/

P.S: removed old extra forum directory and moved to root of the subdomain.
 
Anyone an indea how to convert this? (/ to _)

Code:
[MEDIA=dumpert]7713821/76bbe55a[/MEDIA]
to
[MEDIA=dumpert]7713821_76bbe55a[/MEDIA]
 
Last edited:
hello i have to replace [MENTION= with [USER=

Quick Find: [MENTION=
Regular Expression: #/[MENTION= .....i don't know hot to close the expression
Replacement String: [USER=

can you give me suggestion please?
thanks.
 
hello i have to replace [MENTION= with [USER=

Quick Find: [MENTION=
Regular Expression: #/[MENTION= .....i don't know hot to close the expression
Replacement String: [USER=

can you give me suggestion please?
thanks.
[/QUOTE]

i find it: #\[MENTION=#siU
have worked very well.
 
Hi guys,
Will this work if I wanted to change the name of quotes after a username change? If so, can someone give me an example please providing it will not cause any issues

Thanks in advance!
 
i use sql command for find and replace. but only if the username is an obscure keyword. not sure it would be possible to safety do a find and replace if the username is a common word 🤔
 
Top Bottom