• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Post replace

MrC

Active member
#1
I am using Post Replace addon by Kier to replace a string, say "xyz", with a space. Should I put " " (space - without the quotation marks) in the Replacement String box? If not, do I need to put some special character, which represents the space character, in the box? And what should the special character be?

Thanks.
 

Jake Bunce

XenForo moderator
Staff member
#2
For simple replacements you can use a direct query on the database:

Code:
UPDATE xf_post
SET message = REPLACE(message, 'xyz', ' ');
You don't need Kier's addon for this simple replacement.
 

MrC

Active member
#3
Sorry :). My example was over simplified. To be precise, I am trying to remove the tag lines created by the Double Post addon and replace each tag line by a space. The tag lines have the following format:

Code:
[DOUBLEPOST=1352988138][/DOUBLEPOST] (where the number is the posted date)
So I used:

Code:
Quick Find: [DOUBLEPOST
 
Regular Expression: #\[DOUBLEPOST=\d+\]\[/DOUBLEPOST\]#siU
 
Replacement String: " " (without the quotation marks)
I tested the above, it seemed to find all the tag lines created by Double Post, but the Replacement String boxes were empty (no space characters). So I am guessing I did not do it correctly.
 

Jake Bunce

XenForo moderator
Staff member
#4
It's correct. I tested it.

A space character replacement will show as "empty". It only shows the replacement for the actual matched text, not the entire post.
 

MrC

Active member
#5
It's correct. I tested it.

A space character replacement will show as "empty". It only shows the replacement for the actual matched text, not the entire post.
I created a simple text for testing: "helloxyzkJake Bunce". And I did the following with Post Replace

Code:
Quick Find: xyzk
 
Regular Expression: #xyzk#
Replacement String: " " (without the quotation marks)
The text, after the replacement, became "helloJake Bunce". But it should be "hello Jake Bunce".