Resource icon

Post Content Find / Replace 1.0.0

No permission to download
@Kier

Keep running this, but I noticed it does not always save even when you click save. Because I'll repeat the search and basically find the same results for the same post.
 
I've got an interesting one for you...

PHP:
[img]{vb:stylevar imgdir_misc}/users_online.png[/img]
I can do this with ease but...for the replacement to be correct I would need to know the directory info behind (imgdir_misc)

I'm too tired to do anything useful today but give me that info and I will check this out tomorrow on the wake-up.
 
I have a bunch of old [video] tags which I believe are remnants left over from when the forum was running phpBB before vBulletin. I used the vB video find and replace string but I still have a bunch of video tags like this that pre-date vB:

Code:
[video]http://www.youtube.com/v/qRuNxHqwazs&hl=en&fs=1&rel=0[/video]

Would anyone be so kind as to set me up with the regex I need to convert these?
 
Code:
[video]http://www.youtube.com/v/qRuNxHqwazs&hl=en&fs=1&rel=0[/video]



Quick Find:
Code:
[video


Regular expression:
Code:
#(?:\[video])http(?:s)?://(?:www\.)?(?:[a-z0-9-]+\.)?youtu(?:be\.com/(?:[a-z]+(?:/api/videos/)?)|\.be)(?:\?v=|/)?([a-z0-9_-]{11})(?:[^\s]+)?(?:\[/video])#siu


Replacement String:
Code:
[media=youtube]\1[/media]
 
Quick Find:
Code:
[video


Regular expression:
Code:
#(?:\[video])http(?:s)?://(?:www\.)?(?:[a-z0-9-]+\.)?youtu(?:be\.com/(?:[a-z]+(?:/api/videos/)?)|\.be)(?:\?v=|/)?([a-z0-9_-]{11})(?:[^\s]+)?(?:\[/video])#siu


Replacement String:
Code:
[media=youtube]\1[/media]

Thank you! Worked perfectly.
 
1. I've got a few thousand image links that are all dead links. They are all of the following format:
Code:
http://184.72.239.143/mu/randomnumber.jpg

These are all wrapped in image tags. How do I use the tool to find them all and delete them. It would more a removal of broken images.

Thanks. Excited about this tool as I've got 2400 of these.

2. I've got a ton of broken image links from gallery pages from old mac.com sites.

They are all of the format:
Code:
http://gallery.mac.com/username/
http://idisk.mac.com/username/
http://homepage.mac.com/username/

They have various different strings at the ends of their URLs.

3. Due to legal issues a few years back, I was forced to change my domain. I still have links to the old site, which don't resolve. How can I change domain.com/forum/thread.123 to newdomain.com/forum/thread.123
 
Last edited:
How would you use this to change all none youtube links. Basically I would like to convert all non youtube links into a URL.

From:
Code:
[ame=www.SomeLongWesbitesiteURL.com(or another extension)]A description of the site[/ame]

T0:
Code:
[URL='http://www.SomeLongWesbitesiteURLcom(or another extension)']A description of the site[/URL]


Since I dont know the name of site im looking for, I just want to find all site that do not have youtube in the name.

Thanks!
 

Quick Find:
Code:
v6mustang.com/threads


Regular expression:
Code:
#(\[url(?:]|[^]]+]))(http://www\.v6mustang\.com/threads/[0-9]+/)[^\[]+(\[/url])#siu


Replacement String:
Code:
[url]\2[/url]



__________________________________________________




dead image links links

format:
Code:
http://184.72.239.143/mu/randomnumber.jpg

find them all and delete them.

Quick Find:
Code:
184.72.239.143


Regular expression:
Code:
#(\[img]http://(?:www\.)?184\.72\.239\.143/mu/[a-z0-9-]+\.(?:jpg|jpeg|png|gif|bmp|tif)\[/img])#siu


Replacement String:
Code:
IMAGE-REMOVED


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


2. broken image links

They are all of the format:
Code:
http://gallery.mac.com/username/
http://idisk.mac.com/username/
http://homepage.mac.com/username/

They have various different strings at the ends of their URLs.
Those various strings are important and necessary in order to do anything about it.

find one of those links in a post, while logged in as an admin/mod edit the post and then click the icon to the right for 'use bbcode editor ' and then copy the contents for one of the links tags and all and then paste them into a code block here.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

3. change domain.com/forum/thread.123 to newdomain.com/forum/thread.123


Quick Find:
Code:
domain


Regular expression:
Code:
#domain(\.com/forum/thread\.[0-9]+[^\s]+)#siu


Replacement String:
Code:
newdomain\1



__________________________________________________



How would you use this to change all none youtube links. Basically I would like to convert all non youtube links into a URL.

From:
Code:
[ame=www.SomeLongWesbitesiteURL.com(or another extension)]A description of the site[/ame]

T0:
Code:
[URL='http://www.SomeLongWesbitesiteURLcom(or another extension)']A description of the site[/URL]


Since I dont know the name of site im looking for, I just want to find all site that do not have youtube in the name.

Thanks!
that's not enough information for me, I refer to what I told the gent above...

find one of those links in a post, while logged in as an admin/mod edit the post and then click the icon to the right for 'use bbcode editor ' and then copy the contents for one of the links tags and all and then paste them into a code block here.
go to one of the posts that has an ame link that is not youtube and follow the above process so that I can get a better picture of what needs to be done.
 
Last edited:
that's not enough information for me, I refer to what I told the gent above...


go to one of the posts that has an ame link that is not youtube and follow the above process so that I can get a better picture of what needs to be done.

Thanks for looking into this:

Basically there are too many different urls to list but the idea is just to replace the "[ame=" with "[U RL=" and "[/ame]" with "[/ U RL]"
[CODE]
- [ame="http://en.wikipedia.org/wiki/Bulletin_board_system"]Tigger BBS[/ame]
- [ame="http://en.wikipedia.org/wiki/Honda"]Honda[/ame]
- [ame="http://www.vimeo.com/12833600"]Four Wars 3-5-12 on Vimeo[/ame]
- [ame="http://s64.photobucket.com/albums/h170/crawlertypeofguy/?action=view&current=DSCF2215.flv"]DSCF1215.flv video by crawlertypeofguy - Photobucket[/ame]
- [ame="http://video.google.com/videoplay?docid=8769128457543333500&q=winchester+bay&total=71&start=0&num=10&so=0&type=search&plindex=4"]YouTube - Banshee Bay Oregon[/ame]
[/CODE]
It woudl be quite easy to maybe do this regex "#\[ame\=(.+)\[\/ame\]#siu" but that would destroy the working youtube video urls if this is run while there are still some video urls left. Can something be added to the above short regex to exclude if it contains "youtube" anywhere between the ame tags?

Also, I used a great code you provided some posts earlier and slightly modified it to include all possible subdomian (www, m, de, ca, etc.. ), possibility of having quotes around url and the secure version of youtube urls (https):

From:
Code:
#\[ame\=http\:\/\/(www\.)?youtube.com\/watch\?([a-z]+\=[^\=\&\]]+\&)*v\=([^\]\&]+)(\&[a-z]+\=[^\=\&\]]+)*\][^\[]+\[\/ame\]#siu

To:
Code:
#\[ame\=('|"|)http(s)?\:\/\/[^\.]*(\.)?youtube.com\/watch\?([a-z]+\=[^\=\&\]]+\&)*v\=([^\]\&\"]+)(\&[a-z]+\=[^\=\&\]]+)*('|"|)?\][^\[]+\[\/ame\]#siu

After this update I still ran into a few issues where the following domain were not affected because either the Description was left blank or the description contained brackets:
Code:
- [ame=http://www.youtube.com/watch?v=XjiwBwBL4Qo]YouTube - Classified - "Oh... Canada" [Official Video][/ame]
- [ame="http://www.youtube.com/watch?v=RboEtvkm4RU"][COLOR=#0000ff]YouTube- ATV's Most Wanted Susan Parker[/COLOR][/ame]
- [ame="http://www.youtube.com/watch?v=SZq8WppNFJY"][COLOR=yellow]http://www.youtube.com/watch?v=SZq8WppNFJY[/COLOR][/ame]
- [ame="http://www.youtube.com/watch?v=sWEKU9fEBno"][/ame]
- [ame="http://www.youtube.com/watch?v=9YAPKlk0pfY&feature=related="]YouTube - le burn a la marocaine[/ame]

Any idea on how to modify the above regex to include those or would it be better to just write a separate one for the select few cases?
 
Quick Find:
Code:
184.72.239.143


Regular expression:
Code:
#(\[img]http://(?:www\.)?184\.72\.239\.143/mu/[a-z0-9]+\.(?:jpg|jpeg|png|gif|bmp|tif)\[/img])#siu


Replacement String:
Code:

When I run it, nothing happens. It remains the post and replace screen, as if it's not able to find anything.

Here's an example of the BBD code associated with the assorted images.

Code:
[IMG]http://184.72.239.143/mu/ad314e39-3ae3-9271.jpg[/IMG]

Those various strings are important and necessary in order to do anything about it.

find one of those links in a post, while logged in as an admin/mod edit the post and then click the icon to the right for 'use bbcode editor ' and then copy the contents for one of the links tags and all and then paste them into a code block here.

Here are a few of the BBCodes for those broken image URLs, most caused by Mac.com closing.

Code:
[IMG]http://idisk.me.com/scottjf8/Public/Pictures/Skitch/DSC_0002-20090512-151409.jpg[/IMG]

[IMG]http://gallery.mac.com/kings05/100008/photo1231443152669/web.jpg[/IMG][/QUOTE]

Thanks, I greatly appreciate your help. Having just found a lot of these links today, I'm anxious to get my site cleaned up.
 
This is why I ask for the EXACT examples from the bbcode editor view of a post containing the content copied and pasted here..

above you asked for
http://184.72.239.143/mu/randomnumber.jpg

but it in no way tells me that it will have an alpha numeric string with dashes in it after the last slash.
http://184.72.239.143/mu/ad314e39-3ae3-9271.jpg

I have edited the above post to reflect that, try it now.



I just got out of bed and need coffee, I'll be back later.
 
Great addon, I just discovered this problem a week after migration from vB4 (once I fixed the FF and https issue)

So before I actually execute anything, 1) going to turn off the board and do a full backup and 2) I want to make sure I have the coding right.

I have ran across a few scenarios on my existing board (which is not large yet)

I need to convert the following situations:

#1
Code:
[video=youtube;xj0SF_V4C_U]https://www.youtube.com/watch?v=xj0SF_V4C_U[/video]

Fix for #1

Code:
Quick Find: [video=youtube;
Regular expression: #\[video=youtube\;([a-z0-9]+)\]http.+\/watch.+v=[a-z0-9]+\[\/video\]#siu
Replacement String: [media=youtube]\1[/media]


#2
Code:
[video=youtube_share;0yU2sxineQQ]http://youtu.be/0yU2sxineQQ[/video]

Fix for #2

Code:
Quick Find: [video=youtube_share;
Regular expression: #\[video=youtube_share\;([a-z0-9]+)\]http.+\/watch.+v=[a-z0-9]+\[\/video\]#siu
Replacement String: [media=youtube]\1[/media]

#3
Code:
[URL]http://youtu.be/p-h4VVRMj5A[/URL]

Fix for #3?

This one gets cleanly fixed when I simply Edit and Save the post. The others do not as they leave a hanging video=youtube text preceeding the video. But I don't want to have to go find and edit every post with a URL youtube link.

Thanks ahead of time
 
This is why I ask for the EXACT examples from the bbcode editor view of a post containing the content copied and pasted here..

above you asked for
http://184.72.239.143/mu/randomnumber.jpg

but it in no way tells me that it will have an alpha numeric string with dashes in it after the last slash.
http://184.72.239.143/mu/ad314e39-3ae3-9271.jpg

I have edited the above post to reflect that, try it now.



I just got out of bed and need coffee, I'll be back later.

It generated the list, which was great. When I select save changes either before or after creating the list, it kicks back the error code - Please enter a valid message. I tried adding a space or two, but no change.

Thanks again. If I can delete 1900 broken image links, this would make my day -- better yet, my week!
 
I need to convert the following situations:

#1
Code:
[video=youtube;xj0SF_V4C_U]https://www.youtube.com/watch?v=xj0SF_V4C_U[/video]

Fix for #1

Code:
Quick Find: [video=youtube;
Regular expression: #\[video=youtube\;([a-z0-9]+)\]http.+\/watch.+v=[a-z0-9]+\[\/video\]#siu
Replacement String: [media=youtube]\1[/media]

...ok being a newbie here I didn't notice the Save Changes checkbox that you can leave unchecked and just test this type of stuff. I should have figured that this would have been incorporated!!

I did find that I have some posts that have multiple links in the same post, and the addon treats these as a single video. For instance, it wants to replace

Code:
     [video=youtube;Lalx66vIAl4]http://www.youtube.com/watch?v=Lalx66vIAl4[/video] [video=youtube;JNwnwdAV8wI]http://www.youtube.com/watch?v=JNwnwdAV8wI[/video] [video=youtube;j2-FsaNufL4]http://www.youtube.com/watch?v=j2-FsaNufL4[/video] [video=youtube;UTCJBnhYbnk]http://www.youtube.com/watch?v=UTCJBnhYbnk[/video]

with

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

For me, this is a simple thing, I can just fix the individual posts where this occurs and let the addon fix the rest. But I'm just curious how one would handle this otherwise, as I'm sure there are others out there with many more posts containing multiple links in a single post...
 
Top Bottom