Resource icon

Post Content Find / Replace 1.0.0

No permission to download
can you give me full links please...it is hard to guess what the rest of the link looks like for forum software I don't use and I really need full links to do this. You can convo me those if you like...

Also are you looking for a fix to the regex for the urls , or are you just testing now and looking to have the expression fixed so that it catches it on the first shot?

I got the hang of it now with your help. The regular regex which I use in Javascript wasn't working now that you have shown me examples got the delimiters I was looking for.

Even I am not sure of all the URL parameters used in Phpbb. I am seeing the Google webmasters tools URL parameters tools and updating it one by one.

I am testing it not working on live site. I will update this thread with what I find. I will PM the URL's.
 
ok so I think I may have a way to make this work though not sure...still playing with some stuff and the only way I know I can do this currently is to actually modify this addon.

And a question...

Does the bold part in: 'viewtopic.php?f=69&t=691165&start=15#p3865565' refer to - 'open the page starting at post 15 in that particular thread' which supposes that your forum shows 15 posts a page currently?
 
Does the bold part in: 'viewtopic.php?f=69&t=691165&start=15#p3865565' refer to - 'open the page starting at post 15 in that particular thread' which supposes that your forum shows 15 posts a page currently?
Yes that is correct. That number varies depending on number of posts per page.

If you have set number of posts to 15 per page.
Page 3 will be 'viewtopic.php?f=69&t=691165&start=30#p3865565' Page 4 'viewtopic.php?f=69&t=691165&start=45#p3865565'
 
Well... I was sort of successful. :)

Thanks to your collective help with the regex (I'm totally helpless with it), I've converted my old VB4 youtube tags to the following:

Code:
[media]http://www.youtube.com/watch?feature=player_embedded&v=q2Axn0xpufM[/media]

Which is exactly how it now appears in posts. As text. Tags included.

If I go into an individual post to edit it, change nothing and save, the forum successful converts the link to an embedded video. What it changes to is:

Code:
[media][media=youtube]q2Axn0xpufM[/media]

And that's fine except:

1. It places the text of
Code:
[media]
in front of the embedded video.
2. I can't exactly edit/save every single post in the forum to force the conversion.

So I think what I need is:

1. a way to strip everything in the link up to and including the "v=" as well as everything after that code. For instance, some links appear as
Code:
http://www.youtube.com/watch?v=hpxWTtq4wjk&feature=player_embedded
. So I need to eliminate everything up to an including "v=" and everything from "&" to the end of the link.

2. change
Code:
[media]
to
Code:
[media=youtube]
.

Once all that's done, do I need to rebuild the forum in some way to force the software to do the embedding?

Regardless, I throw myself at the mercy of you regex heroes. Thank you if you have a moment to help me!
 
Well if you already changed all of your tags and you just want to change ..

[media][media=youtube]q2Axn0xpufM[/media]
to
[media=youtube]q2Axn0xpufM[/media]

you can do this...

Code:
Quick Find:           [media][media=youtube]
Regular expression:   #\[media](\[media=youtube\])#siu
Replacement String:   \1

______________________________________________________________

Now if you want to change
[media]http://www.youtube.com/watch?feature=player_embedded&v=q2Axn0xpufM[/media]
to

[media=youtube]q2Axn0xpufM[/media]


Code:
Quick Find:           [media
Regular expression:   #(\[media])http:\/\/(www\.)?(youtube)\.com\/watch\?(feature=player_embedded\&)?v=([a-z0-9]+)(\[\/media])#siu
Replacement String:   [media=\3]\5\6




Once all that's done, do I need to rebuild the forum in some way to force the software to do the embedding?
If you are talking about the auto embedding no...xenforo does that automatically. See what happens is when you post a youtube link at post time (or upon editing and saving) xenforo parses that link and turns it into the media tags. All youtube links will just embed from now on when you click post reply


ok time to wake up...I need coffee let me know how that works out for you.
 
Last edited:
Thanks! That did the trick for many of the links. There were some that had trailing stuff, and those didn't carry over so well, but at this point... hey... 80% good is better than what I had! Really appreciate it.
 
Gimme some of the other examples, I would have included them in one expression had I known that the pattern was not unique.
 
Ah man, you're the best. Okay... here are the examples of some stuff as they currently appear (as text) in posts. As you can see, in each example, they deviated enough to evade capture and replacement.

Code:
[media]http://www.youtube.com/watch?feature=player_embedded&v=8GBVF8FzPI0#![/media]

Code:
[media]http://www.youtube.com/watch?v=Iuv__-nyO1M[/media]

Code:
[media]http://www.youtube.com/watch?v=hpxWTtq4wjk&feature=player_embedded[/media]

Really appreciate this.
 
Try this without saving...let me know if it get's you good results...I can't test it thoroughly without a good set of sample data like a full import so I am kind of playing it by ear or whatever saying fits here.

This one should catch everything including your original links which were already converted at this point. If you are doing this as a test...this is the expression to use in the final as it will (or is supposed to) catch everything
Code:
Quick Find:           [media=
Regular expression:   #(\[media])http:\/\/(www\.)?(youtube)\.com\/watch\?([^\-?=\&]+\=[^\-?=\&]+\&)*v\=([a-z0-9_-]+)(\&[^\-?=\&]+\=[^\-?=\[\&]+)*(\[\/media])#siu
Replacement String:   [media=\3]\5\7
 
Okay, this definitely converted a bunch more, but not all of them. For instance, this is still unconverted:

Code:
[media]http://www.youtube.com/watch?v=WNQ6_1GCVVA[/media]

I know you already know this, but you've gone way beyond the call of duty, so if you've had enough, I'm totally fine with that! I really appreciate all the attention.
 
I'm not very good with regex and I looked all over this thread for an exact example of how to remove some old AME tags but didn't see anything. Here's what I currently have and want to get rid of

[ame=[media=youtube]QrDTmOECeMw[/media] - Inner City - YouTube[/ame]


I'm wondering if i'll even be able to run this with 5 million posts or if I'll need to do some db queries :unsure:
 
Hi. Get this error when going to Tools -> Replace in Posts:
Code:
A controller for the route path post-replace/ was not found.
Is there any idea why it is happening?
 
Hi. Get this error when going to Tools -> Replace in Posts:
Code:
A controller for the route path post-replace/ was not found.
Is there any idea why it is happening?

If you go to your library folder at your site, is there a folder called PostReplace in it?
 
Top Bottom