Resource icon

Post Content Find / Replace 1.0.0

No permission to download
The first error is because you have more replacements to make than your servers memory can handle in one shot. You can either increase your memory (which may not help you at all depending how many replacement you need to make per expression), or you can follow Jake's mod for this addon which will add a batch processor type of function so that it won't try to do more than it can per run.


The second error is because you are not using an ending delimiter, when dealing with regex think of a delimiter as a border marker to tell your server to either start treating the following as regex or to tell it to stop interpreting it at regex. Even when you follow a plain text match in regex you still need delimiters for your server to know to treat a string as regex, like you might want to match the word hungry and though it seems pointless you really need to wrap it with delimiters like this #hungry# (I use # for delimiters but there are others that can be used) For that try fixing your expression so that it is wrapped on both sides with #.


As far as your actual needed expression goes...when requesting help in this thread the best way to go about it is to open an example post at your forum, click edit, then click use bbcode editor (icon that looks like a wrench over a piece of paper). What you see when editing with the bbcode editor is what I actually need to see in order to make someone a proper expression for their board.


Thank you,

Parts of the BB code is variable but I will give you an example of what I'm trying to change with the variable included. I've got:
Code:
[URL='http://artsuk.org/community/attachments/mfl_spanish_overview1-12-pdf.66611/']
I need it to be:
Code:
[URL='http://www.tag.ac/attachments/mfl_spanish_overview1-12-pdf.66611/']

There are various attachments throughout the site with the same problem as we changed domain & moved the XF install to our root directory. Unfortunately, I'm not sure how to vary the regex to isolate and change the code before the '/attachments' section as I've never written using it & I cannot figure it out from the advice I have seen online.

Perhaps after I have done one I can tweek it, I am hoping there is a way to express wild card endings like www.artsuk.org/* similar to what you can do in URL redirects. :)
 
Any ideas how to find and replace the following:

Code:
[YT]unBUaf-hrGA&hl[/YT]

Other examples:

[YT]qUddGZpA5pE&hl[/YT]


[YT]wHc_PojFRVg&hl[/YT]


It is a youtube tag. I tried


Code:
Quick Code: [YT
Regular Expression: #\[YT\]([A-Za-z0-9-_]++)\[/YT\]#
Replacement String: [media=youtube]\1[/media]

And it finds nothing, even though I see it in the posts. Ideas?
 
Any ideas ...

#\[YT\]([A-Za-z0-9-_]++)\[/YT\]#

it finds nothing, even though I see it in the posts. Ideas?

the reason it is not matching is because you are trying to match
TAG | YOUTUBE_ID | TAG

But you really have this to match
TAG | YOUTUBE_ID | &hl | TAG


In reality your original bbcodes contain more than just the media id from youtube, they have an & something after the id (which is only 11 characters), you also don't want a double ++ there, basically [a-z0-9]+ can be read aloud as all letters or numbers so having a ++ (where + means match 1 or more) there is not going to really help you. Very close though...if you removed the second+ before the ) and added something to account for the &stuff after the ) it probably would have worked out for you.


I don't have much time to test yours out at the moment but for now I can offer something which should get you right to the results.


Quick Find:
Code:
yt

Regular expression:
Code:
#(?:\[yt])([a-z0-9_-]{11})(?:\&[^\[]+)(?:\[/yt])#siu

Replacement String:
Code:
[media=youtube]\1[/media]
 
the reason it is not matching is because you are trying to match
TAG | YOUTUBE_ID | TAG

But you really have this to match
TAG | YOUTUBE_ID | &hl | TAG


In reality your original bbcodes contain more than just the media id from youtube, they have an & something after the id (which is only 11 characters), you also don't want a double ++ there, basically [a-z0-9]+ can be read aloud as all letters or numbers so having a ++ (where + means match 1 or more) there is not going to really help you. Very close though...if you removed the second+ before the ) and added something to account for the &stuff after the ) it probably would have worked out for you.


I don't have much time to test yours out at the moment but for now I can offer something which should get you right to the results.


Quick Find:
Code:
yt

Regular expression:
Code:
#(?:\[yt])([a-z0-9_-]{11})(?:\&[^\[]+)(?:\[/yt])#siu

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

Hi,

We're not looking to update our YouTube links, we've got attachements that are saved in the post using a different domain name e.g.
Code:
[URL='http://artsuk.org/community/attachments/mfl_spanish_overview1-12-pdf.66611/']

We need the domain to change from the above to: tag.ac

Thanks
 
Anyone come across this message when they try to access the tool in ACP?
"An unexpected error occurred. Please try again later."
 
To be honest I have never seen an error thrown just by opening the tool up other than when the files were not uploaded into the library directory in the first place. Did the tool work for you before or are you just trying it out for the first time?
 
Last edited:
I'm trying to replace:
Code:
 [attachment=XYZ]
with
Code:
[attach]XYZ[/attach]
Any tips? I do not comprehend PCREs :( Thanks in advance!
 
I'm trying to replace:
Code:
 [attachment=XYZ]
with
Code:
[attach]XYZ[/attach]
Any tips? I do not comprehend PCREs :( Thanks in advance!

Code:
 [attachment=XYZ]
is there a closing tag to this...or on your board is this an entire bbcode in one tag?
 
That's the entire BB code for that attachment. This is how MyBB 1.6.x uses BB code for image attachments.
 
When I click 'proceed' with those strings the page reloads, unchanged.
I'm confused. I'm thinking "XYZ" shouldn't be involved as it was just part of my example... I have many posts with many different attachments shown like this:
Code:
[attachment=4094]
[attachment=3084]
[attachment=254]
And I need them to be changed to:
Code:
[attach]4094[/attach]
[attach]3084[/attach]
[attach]254[/attach]
 
Yea sorry i just literally woke up....i edited it....try it now
Any idea on how to update old image urls?
Code:
[URL='http://artsuk.org/community/attachments/mfl_spanish_overview1-12-pdf.66611/']
We need the domain to change from the artsuk.org to: tag.ac

Thanks[/URL]
 
Last edited:
@Kier

I have 45,000   and i would love to replacement with a space when i try it with the expression #\ # i get the following error:

Error
Please enter a valid message.

I there a way I can clean these up using your PCF tool?

I also tried \2 as the expression but still the same error.
 
Last edited:
this one shouldnt be too hard

[DOUBLEPOST=1397693363][/DOUBLEPOST]


just want to completely remove these. they are all the same format just different numbers.
 
Having trouble with these
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
Code:
[URL='http://www.megaupload.com/?d=F16HJRLD']My homework: maths[/URL]
Code:
[URL]http://www.megaupload.com/?d=JJKT6RIS[/URL]
 
Last edited:
I need you guys again! Thanks ahead on this :)

I was on a cloud server that used static directories for the obvious. I've since moved the a dedicated and now see some images are broken, pointing to a static directory. Can I replace the static.mydomain so they will all work again?
 
Last edited:
Top Bottom