Resource icon

Post Content Find / Replace 1.0.0

No permission to download
Hi @Jake Bunce,

What would be the regular expression to find and remove:

[SIZE=+1] and [/SIZE]

For example here...
http://www.sikhphilosophy.net/threads/milni-at-sikh-weddings.22246/#post-82466

I have tried:

Quick find: [SIZE=+1]

Regular expression: "[SIZE=+1]" or "/[SIZE=+1]/"

Its not finding the exact search string: [SIZE=+1] or [/SIZE]

Please advice.

Quick Find: [SIZE=+1]

Regular Expression: #\[SIZE=\+1\]#siU

Replacement String: [SIZE=1]

That should do it.

In the regex you have to escape (backslash) certain characters like brackets and plus symbols.
 
Hi, I migrated the forum from mybb to xenforo.. then the site is already live, hoever there are bbcode and images issues on the post. I will use this mod to replace the text, My questions is do I need to 'TURN OFF' my forum? or its okay to run this without turning off the forum?
 
Hi, I migrated the forum from mybb to xenforo.. then the site is already live, hoever there are bbcode and images issues on the post. I will use this mod to replace the text, My questions is do I need to 'TURN OFF' my forum? or its okay to run this without turning off the forum?

You can run it while live.
 
I would like to replace all my internal links to my old domain with the new one.
I have links pointing to http and https versions of the old domain and I would like to point all my internal links to my new domain (https)

Is that possible? How can I do that?

Thanks! :)

Edit : found it! (after trial and error) ;)

This is what I used
Code:
QF
example.net

RE
#((http(?:s)?://)(?:www\.)?)(example\.net)([^\[\s']+)?#siu

RS
https://example.com\4

The next thing I'm trying is to change

https://example.com/register.php to https://example.com/login

I appreciate your help.

Thanks!
 
Last edited:
@Fred.

For simple replacements you can use a direct query on the database:

Code:
UPDATE xf_post
SET message = REPLACE(message, 'http://example.net', 'http://example.com');

You don't need Kier's addon for this simple replacement.
 
Can someone advice a regex to delete all empty IMG bbcode?
Like this:
Code:
[img][/img]
Thanks!


Edit:
I think this direct query will do:
Code:
UPDATE xf_post SET message = REPLACE(message,'[img][/img]','');
466 rows affected. (Query took 2.0769 seconds.)
 
Last edited:
So another regex I'm searching for.
Regex to remove all [ img ] bbcode not enclosing a valid url?

Sample:
Code:
this is random post ..
and [img] random appear without an image.
random message then..
[/img] close tag appear
 
So another regex I'm searching for.
Regex to remove all [ img ] bbcode not enclosing a valid url?

Sample:
Code:
this is random post ..
and [img] random appear without an image.
random message then..
[/img] close tag appear

Try this for open tag:
Code:
/\[img\](?!((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?))/i

And this for closing tag:
Code:
/(?!((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?))\[\/img\]/i

don't check "Save Changes" until you make sure all results are valid. It hasn't been tested.
 
  • Like
Reactions: rdn
Can someone help me change this:

Code:
[IMG]http://www.example.com/forum/attachment.php?attachmentid=49056&d=1416873612[/IMG]

To this:
Code:
[IMG]http://www.example.com/xendev/attachments/ol41-jpg.49056/[/IMG]
Or this
Code:
 [IMG]http://www.example.com/xendev/attachments/49056/[/IMG]

Either seem to work fine in xenforo

I'm not sure what d=1416873612 in the first link is, but I don't think I need it.

Thanks!
 
Hello, Try this one:

Quick Find:
Code:
[IMG]http://www.example.com/forum/attachment.php?attachmentid

Regex:
Code:
#(\[img]http://www\.example\.com)/forum/attachment\.php\?attachmentid=([0-9]+)&d=([0-9]+)(\[/img])#siu

Replace:
Code:
\1/xendev/attachments/\2/\4

Always try first without saving.
 
Back
Top Bottom