Resource icon

Post Content Find / Replace 1.0.0

No permission to download
That worked perfect. Thanks

Also your point is good about the manual issue, because on a big board that would be tedious. I only had 3-5 instances that wouldn't get fixed right, and a sum total of maybe 100-130 embedded video links all together.
 
Hi! I found several old megaupload links at my forum that now are broken. I'd like to remove them.
Is there an easy way using this addon?
The urls are something like:
Code:
[URL]http://www.megaupload.com/?d=X1TERMZD[/URL]
Thanks!
 
Hi! I found several old megaupload links at my forum that now are broken. I'd like to remove them.
Is there an easy way using this addon?
The urls are something like:
Code:
[URL]http://www.megaupload.com/?d=X1TERMZD[/URL]
Thanks!
As long as you have a regular expression that matches the signature you are going for, this addon makes things really easy.


Quick Find:
Code:
megaupload


Regular expression:
Code:
#\[url(?:]|=')(http://(?:www\.)?megaupload\.com/\?d[^\[']+)(?:(?:'])?[^]]+])#siu


Replacement String: (you can use a string like LINK REMOVED or leave this blank, if you have posts that contain only a MU link then you will need to supply something in this field otherwise after replacing it will be trying to save blank posts which is a no go.)
Code:
 
Can I use this to replace quoted names after a username change. Eg as below...

Find
[quote="Old Name, post:

Replace
[quote="New Name, post:


I'd also like to use it to replace tags like this...

Find
Code:
[USER=435]Old Name[/USER]

Replace
Code:
[USER=435]New Name[/USER]
 
Can I use this to replace quoted names after a username change. Eg as below...

Find
[quote="Old Name, post:

Replace
[quote="New Name, post:


I'd also like to use it to replace tags like this...

Find
Code:
[USER=435]Old Name[/USER]

Replace
Code:
[USER=435]New Name[/USER]

@EQnoble

I see you're online buddy. Any advice on how to do this?
 
Gimme a lil bit ...

I'm balls deep in a hailmary series of nested foreach loops containing for loops and going through them all and trying to track down why a variable in a variable variable is not rotating with the cycle and I may be on the verge of finding the error or going insane and i need to flip the coin and try to finish this before doing anything else.

I'll update this post if no one posts in between now and when I get back.
 
Gimme a lil bit ...

I'm balls deep in a hailmary series of nested foreach loops containing for loops and going through them all and trying to track down why a variable in a variable variable is not rotating with the cycle and I may be on the verge of finding the error or going insane and i need to flip the coin and try to finish this before doing anything else.

I'll update this post if no one posts in between now and when I get back.

No rush EQ. I managed to do it with a SQL query with help from @xfrocks so it's already done.
 
I too converted from phpBB and had to run hundreds of regex and SQL queries to fix all the broken BB Code, due to the random hex strings you've mentioned above.

Try this for YouTube.

Take a backup first though!

Quick Find
Code:
[youtube

Regular Expression
Code:
#\[(youtube):([a-z0-9_]+)\](.*)\[/\1:\2]#siU

Replacement String
Code:
[\1]\3[/\1]

Don't forget that you will also need to convert the tags from youtube to media=youtube.
You can do that with standard queries.
Code:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');

Any idea how I can do the first part after running the UPDATE query in the second part? I thought I would be able to handle everything through queries in phpMyAdmin, however, there are several youtube codes that include the full URL or some additional code as well that simply don't show up now. Unfortunately the Post Content/Replace does not work for me. I guess my server doesn't have enough juice to run that for the number of threads I have and it consistently returns an error.
 
Any idea how I can do the first part after running the UPDATE query in the second part? I thought I would be able to handle everything through queries in phpMyAdmin, however, there are several youtube codes that include the full URL or some additional code as well that simply don't show up now.

I have never used phpBB but if you give me an example of the full bbcodes (click edit on a post with bbcode in question and then click the button for 'Use BBcode Editor') you need changed I will see what I can do for you.

Unfortunately the Post Content/Replace does not work for me. I guess my server doesn't have enough juice to run that for the number of threads I have and it consistently returns an error.
If it is a memory thing follow this guide that Jake Bunce put together, it will allow you to limit how many results get processed per submit.


http://xenforo.com/community/threads/import-from-ipb-3-2-posts-not-parsed-at-all.39577/#post-435226
 
Last edited:
I am not converting from phpBB... I imported from vB 3.8 and I want to use the phpMyAdmin query system to convert the youtube strings that are still hanging around - essentially i need to remove the "http://youtube.com...." that is in front of some links on my site.
 
I am not converting from phpBB... I imported from vB 3.8 and I want to use the phpMyAdmin query system to convert the youtube strings that are still hanging around - essentially i need to remove the "http://youtube.com...." that is in front of some links on my site.


Generally speaking I only post up regex relevant to this addon in this thread, if I am using a mysql query it is because I need to do more that just a simple regex replacement and even then I only use mysql to grab the data from the db, and put it back after all the processing done in straight php because mysql and the scope of it's regex abilities are just awful without creating custom user defined functions. This addon bridges the divide, it allows one to use regex in a very easy way against their posts table.

Like I said, I need to see an example or two in order to help you.

Go to your forum and click edit on any post with one of the bbcode/youtube links in question, and in the editor toolbar...all the way to the right...click the icon that looks like a wrench over a piece of paper....the bbcode tags with content in between is what I need to be able to tell you the expression to run. Just paste that example in between some [code][/code] tags
 
This addon has 4 folders, all of which are located under library/Xenforo/

One of the folders in the addon is Model, which contains a file post.php, however replacing that file will obviously be very bad.

What am I doing wrong?
 
This addon has 4 folders, all of which are located under library/Xenforo/

One of the folders in the addon is Model, which contains a file post.php, however replacing that file will obviously be very bad.

What am I doing wrong?
You need the four folders from the zip to be in /library/PostReplace/ so you literally just upload the PostReplace directory from the zip to the library folder.
 
I'm using the Link Check addon and found more links like previous megaupload links.
I find these kind of links several times, is there anyway to remove all those links?
I'm trying this:
Code:
Example:
[URL='http://etowalk.com/template/detail/displaydetail.html?itemId=228885']pantalla resistiva[/URL]

Quick Find:
[URL='http://

Regular expression:
#(\[url='http://)(etowalk\.com(?:[^\[]+)?\'])#siu

Replacement String:
http://www.movilesdualsim.com

The same with www.
Code:
Example:
[URL='http://www.etowalk.com/template/detail/displaydetail.html?itemId=228885']pantalla resistiva[/URL]

Quick Find:
[URL='http://

Regular expression:
#(\[url='http://)(?:www\.)(etowalk\.com(?:[^\[]+)?\'])#siu

Replacement String:
http://www.movilesdualsim.com

The replacement string is just optional.
I tried, but it doesn't work.
Any idea??
 
I find these kind of links several times, is there anyway to remove all those links?

Your regex works but does not grab the whole link and both tags, try this without saving first as it is off the top of my head and I only have a minute right now.
Code:
Quick Find:
etowalk

Regular expression:
#\[url='http://(?:www\.)?etowalk\.com(?:[^\[]+)?\'][^\[]+\[/url]#siu

Replacement String:
-link-removed-
 
I've just migrated and I tried to fix YouTube videos but I've messed things up.

Now I ended having this.

When ther is just one video.
Code:
[URL='http://[media=youtube']pebS1TXG6jw[/media][/URL]


When there are several videos, one next to the other.
Code:
[URL='http://[media=youtube']_FbKUsTmPrg[/media]

L_CMjRhv0-U[/media]

p9gimKVujhY[/media][/URL]


Can somebody please help me?
 
I've just migrated and I tried to fix YouTube videos but I've messed things up.

Now I ended having this.

Code:
[URL='http://[media=youtube']pebS1TXG6jw[/media]
_FbKUsTmPrg[/media]
L_CMjRhv0-U[/media]
p9gimKVujhY[/media][/URL]


Can somebody please help me?


Yup but I just woke up and haven't tested this, I would say to take a backup and run this without saving first but seeing that we are trying to fix an existing error, taking a backup at this point would be kind of useless though you should try this without saving first and make sure it only catches the right stuff before letting it run and actually save the replacements.

Quick Find:
Code:
youtube


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


Replacement String:
Code:
[media=youtube']\2\3
 
Thanks @EQnoble :)

I tried it without saving and what it showed me seemed to be OK, but then when I wanted to save I received this error.

Code:
Please enter a message with no more than 5 pieces of media.
 
Back
Top Bottom