Resource icon

Post Content Find / Replace 1.0.0

No permission to download
You don't need this add-on to do that, it can be done with queries.

Take a backup first.

Code:
UPDATE xf_post SET message = REPLACE(message,'[ytube]','[MEDIA=youtube]');

Code:
UPDATE xf_post SET message = REPLACE(message,'[/ytube]','[/MEDIA]');
 
You don't need this add-on to do that, it can be done with queries.

Take a backup first.

Code:
UPDATE xf_post SET message = REPLACE(message,'[ytube]','[MEDIA=youtube]');

Code:
UPDATE xf_post SET message = REPLACE(message,'[/ytube]','[/MEDIA]');

Thank you i will try .
 
Having trouble with these:
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
[URL='http://www.megaupload.com/?d=F16HJRLD']My homework: maths[/URL]
[URL]http://www.megaupload.com/?d=JJKT6RIS[/URL]

Apparently they are not matched by any of the following regular expressions:
Code:
#\[url="http://(?:www.)?(megaupload)[^=]+=([^"]+)"]([a-z0-9\s-\[\]()]+)\[/url]#siu
#\[url(?:]|=')(http://(?:www\.)?megaupload\.com/\?d[^\[']+)(?:(?:'])?[^]]+])#siu
#\[url="http://(?:www.)?(megaupload)[^=]+=([^"]+)"]\[/url]#siu
Am I missing something?
 
Am I missing something?


I need more information because from my perspective I am missing something....

Think of it this way...all I know is that you want to match a MU link, but in reality I also need to know what you are going to do with it...do you want to capture the thing as one group and remove it, do you have a new bbcode to display upload links and need to have the whole link broken into capture groups so that you can use the matches to build your replacement?

These things drastically change the needed expression. Let me know what you want to do with the link so I can pass you something relevant.
 
I need more information because from my perspective I am missing something....

Think of it this way...all I know is that you want to match a MU link, but in reality I also need to know what you are going to do with it...do you want to capture the thing as one group and remove it, do you have a new bbcode to display upload links and need to have the whole link broken into capture groups so that you can use the matches to build your replacement?

These things drastically change the needed expression. Let me know what you want to do with the link so I can pass you something relevant.
You are right. I want to remove them but if they have an anchor text I want to keep it.
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
[URL='http://www.megaupload.com/?d=F16HJRLD']My homework: maths[/URL]
[URL]http://www.megaupload.com/?d=JJKT6RIS[/URL]

Would become
Code:
Link removed
My homework: maths
Link removed
 
You are right. I want to remove them but if they have an anchor text I want to keep it.
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
[URL='http://www.megaupload.com/?d=F16HJRLD']My homework: maths[/URL]
[URL]http://www.megaupload.com/?d=JJKT6RIS[/URL]

Would become
Code:
Link removed
My homework: maths
Link removed
so are you just keeping the text or do you need the link value for like a custom bbcode or something?
 
This is the logical thing to do in this case

First add the link removed text to all MU links with no description and then make all MU bbcodes have the same exact format

Quick Find:
Code:
megaupload

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

Replacement String:
Code:
\1='\3\4'\2Link Removed\5



Now they are all the same and you can replace all megaupload links with the text

Quick Find:
Code:
megaupload

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

Replacement String:
Code:
\1
 
This is the logical thing to do in this case

First add the link removed text to all MU links with no description and then make all MU bbcodes have the same exact format

Quick Find:
Code:
megaupload

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

Replacement String:
Code:
\1='\3\4'\2Link Removed\5



Now they are all the same and you can replace all megaupload links with the text

Quick Find:
Code:
megaupload

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

Replacement String:
Code:
\1


The above regular expressions do not match any results. However I can tell you there are quite a few links on a bunch of threads:
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
[URL='http://www.megaupload.com/es/?d=CO980GLE']Capítulo 1:El Autobot Spike[/URL]
[URL='http://www.megaupload.com/es/?d=QOSC74G7']Capítulo 2:Cambiando a Gears[/URL]
[URL='http://www.megaupload.com/?d=M138WOTQ']Capítulo 3: La ciudad de acero[/URL]
[URL='http://www.megaupload.com/es/?d=6YRNO71Z']Capítulo 4:El ataque de los Autobots [/URL]
 
You need to give better examples then because they do catch ALL things specified by what you originally asked for... (I will take the blame for the replacement where I placed a \1 it should have been a \3 but that would not account for not matching in the first place)

nnnvb.webp
GOGKJ.webp


The character that breaks all the regex in your new example is í which has nothing to do with the regular expression and everything to do with that character which wasn't in your first example , changing that to i and the expressions work...that and the ones that would have been caught but didn't have an /es/ in the link which again I don't use MU so when I say be specific about examples I mean it, otherwise it costs me too much time that I can not afford for me to have to research what could be on your board when it is easier for you to find whats on your board and post it here showing different examples that display ALL of the differences and uniqueness and me only have to work for free once.



I don't have any more free time today so I will let someone else take care of it.
 
You need to give better examples then because they do catch ALL things specified by what you originally asked for... (I will take the blame for the replacement where I placed a \1 it should have been a \3 but that would not account for not matching in the first place)

View attachment 75292
View attachment 75293


The character that breaks all the regex in your new example is í which has nothing to do with the regular expression and everything to do with that character which wasn't in your first example , changing that to i and the expressions work...that and the ones that would have been caught but didn't have an /es/ in the link which again I don't use MU so when I say be specific about examples I mean it, otherwise it costs me too much time that I can not afford for me to have to research what could be on your board when it is easier for you to find whats on your board and post it here showing different examples that display ALL of the differences and uniqueness and me only have to work for free once.



I don't have any more free time today so I will let someone else take care of it.
I'm not blaming you for anything. Actually I really appreciate the time you spend on this :)

The thing is that there may be something else going on here. Because one of the examples I gave you
Code:
[URL]http://www.megaupload.com/?d=74FPEVFL[/URL]
is not being picked up by your regular expression and I know you know what you are doing. What worries me is not that my RE is not working but that yours isn't either.

You are right about those other examples but I think this would take care of them so that's ok
Code:
#(?:\[URL='http://www.megaupload.com/es/\?d=[^']+'])((?:.*?(?!\[/URL]?)).)(?:\[/URL])#siu
 
While we were on IPB, the tagging feature worked something like the following. Can someone please hep out with the replacement expression.
Code:
#[member='Renegade']
 
I have installed this add on, but when I click Proceed anything happens, I see the same screen. But if there is a error in the regular expression it throws a error. Here is my input, I checked my regular expression it is correct.
Quick Find: <strong>
Regular Expression:/^(<strong?)(\>)$/
Replacement String: (BBCode for bold)
Any thoughts?

Thanks
 
While we were on IPB, the tagging feature worked something like the following. Can someone please hep out with the replacement expression.
Code:
#[member='Renegade']
I need to see it on your board to be sure of things and know what I am trying to match for sure


I have installed this add on, but when I click Proceed anything happens, I see the same screen. But if there is a error in the regular expression it throws a error.
While what you are implying is correct the way you apply it to the situation is not...there is not a like a magic expression or a way for the replacement addon to know if your expression applies to your text needed to be matched.

Just because it doesn't throw an error doesn't mean it is correct.
Here is my input, I checked my regular expression it is correct.

Quick Find: <strong>
Regular Expression:/^(<strong?)(\>)$/
Replacement String: (BBCode for bold)
Any thoughts?

Thanks
Your expression is not correct, just because it didn't throw any errors it does not mean it matched anything..all it means is you made a syntactically correct regular expression.

Try this...it will replace with opening and close bold tags,

Quick Find:
Code:
strong

Regular expression:
Code:
#(<strong>)((?:.*?(?!</strong>?)).)(?:(</strong>))#siu

Replacement String:
Code:
[b]\2[/b]
 
Thanks @EQnoble I see a list of matching string, I believe if I check and click proceed it should replace it with BBcode. If you can explain the regular expression or point me to a documentation it will be helpful.

Thanks a lot.
 
Thanks @EQnoble I see a list of matching string, I believe if I check and click proceed it should replace it with BBcode. If you can explain the regular expression or point me to a documentation it will be helpful.

Thanks a lot.
It's rather time consuming to explain of all things regex and I just don't feel that me trying to teach someone regex is wise (I'm self taught) so ... without having save changes checked run the expression and post an example match and it's corresponding replacement, then I can tell you if you should proceed with saving it.
 
Thanks @EQnoble. Here is the few example results
Code:
<STRONG>S360</STRONG>[b]S360[/b]
<STRONG>bestbuy.com</STRONG>[b]bestbuy.com[/b]
<STRONG> </STRONG>[b] [/b]
<STRONG><A href="http://service.test.com/test/click?bid=37919389&amp;site=38776522&amp;bfpage=gway_88x31">BA686</A></STRONG>                                                                                                                   [b]<A href="http://service.test.com/test/click?bfmid=37919389&amp;site=38776522&amp;bfpage=gway_88x31">BA686</A>[/b]
 
Can I replace the vB/DragonByte user tagging BBcode without users getting an alert for every post I change? If so, how would I do it. This is the code:

Code:
[MENTION=7]USERNAME[/MENTION]
 
Top Bottom