Resource icon

Post Content Find / Replace 1.0.0

No permission to download
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.
 
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.

All that means is that you have a post that has more than 5 embeds (which is the default max embeds per message in xf) in it...you can go into your admin control panel and within 'options' find 'messages' and then while you are doing your replacements change 'Maximum Media Embeds per Message' from 5 to 0, when you are done you can change this back to five.
 
Thanks, that worked, we're getting closer, but now I have to fix this ones.

Just in case, this is what I see in the BB Code Editor when I edit the posts.

Code:
[URL='http://[media=youtube'][media=youtube']OtkOofSswP4[/media][/URL]

And...

Code:
[URL='http://[media=youtube'][media=youtube']KQwmcGI33q0[/media]

[media=youtube']Ph-nR09RiYE[/media]

[media=youtube']kKMO5_iTyTg[/media]

[media=youtube']k7c7-QzcTxo[/media]

[media=youtube']6BT6jBjulZ8[/media]

[media=youtube']0FJVi52NUn4[/media]

[media=youtube']nihHG4YH2SQ[/media]

[media=youtube']nUHN3iUfAtg[/media]

[media=youtube']GjvFBZbP2Gg[/media]

[media=youtube']wGrHLnOaQyM[/media]

[media=youtube']QSqlKDDEYqs[/media][/URL]


upload_2014-1-25_16-44-37.webp
 
Yeah i just noticed that there is an error in your bbcode from before we started. Run this to fix that...

Quick Find:
Code:
youtube

Regular expression:
Code:
#\[media=youtube']#siu

Replacement String:
Code:
[media=youtube]


Then run the following to clean up that url then double media tag as well as the closing media followed by the url

Quick Find:
Code:
youtube

Regular expression:
Code:
#(?:\[url='http://)\[media=youtube]|(\[/media])\[/url]#siu

Replacement String:
Code:
\1
 
What do you mean it doesn't work? Like what does it show you in the addon....I just replicated that post in my db and tested the replacements and they work just fine and also tested the expression independently...

efgdfsf.webp
 
I tried to, but regex doesn't seem to be something I can learn in just a couple of minutes (I'm not a programmer), so I'll ask for your help once again.


Code:
[URL]http://youtu.be/2yFMjjk4tis[/URL]

Code:
[URL]http://vimeo.com/83947019[/URL]
 
Code:
[URL]http://youtu.be/2yFMjjk4tis[/URL]

Quick Find:
Code:
youtube

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

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



Code:
[URL]http://vimeo.com/83947019[/URL]

Quick Find:
Code:
vimeo

Regular expression:
Code:
#(?:\[url])http(?:s)?://(?:www\.)?vimeo.com/(?:(?:groups/|album/)(?:[^/]+/)video(?:s)?/)?([^/\[]+)(?:\[/url])#siu

Replacement String:
Code:
[media=vimeo]\1[/media]
 
Those don't seem to work, I've left Save Changes unchecked to check what was going to be changed and nothing showed up. :unsure:
 
This is how it looks in the post:

Code:
[URL]http://forum.emobucket.com/groupcp.php?g=53924[/URL]

I need to replace

Code:
http://forum.emobucket.com

Within that with

Code:
http://www.yabucket.com
 
That happens because some of your posts have only that image in there...if you remove it and it is the only thing you have a blank post which you shouldn't be able to save anyways... if you place something in the replacement field like 'img-removed' it will save.

Running into the same issue. How do I do this without also adding it to every post that is valid?

Edit: Never mind, found your other expression and it worked fine.
 
Last edited:
Running into the same issue. How do I do this without also adding it to every post that is valid?

Edit: Never mind, found your other expression and it worked fine.

If you want to use one expression for all and need something to hold the place of the post for posts with only an image and at the same time not add anything visible to the post, you can just use [plain][/plain] for the replacement value, it wont display anything extra in the visible post...but the post content itself wont be empty, and in the case that the image is not the only thing in the post...this will also add nothing nor shift character spaces other than the removal of the image.
 
This is how it looks in the post:
Code:
[URL]http://forum.emobucket.com/groupcp.php?g=53924[/URL]

replace:
Code:
http://forum.emobucket.com

with:
Code:
http://www.yabucket.com

Are you looking to change (one of the following):
Any link starting with forum.emobucket.com/groupcp.php?= ?
Any link with
forum.emobucket.com in it ?
Any link with
emobucket.com in it at all ?
 
Top Bottom