• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Post Content Find / Replace 1.0.0

No permission to download

Nerbert

Active member
Have you already replaced the closing tags with "[/MEDIA]"?

Don't use those regexes you posted. They will match everything after the opening youtube tag all the way to the end of the post. If you have replaced the closing tags and you can revert it, do so. Those regexes I posted must be able to match the closing tag
 

Alfa1

Well-known member
I would like to make all Wikipedia hotlinks unformatted text. For example
Turn this:
[URL='https://en.wikipedia.org/wiki/Ottoman_Empire']Ottoman Empire[/URL]
Into this:
Ottoman Empire

Preferably it would work also for http and for any language like
[URL='https://XX.wikipedia.org/wiki/Ottoman_Empire']Ottoman Empire[/URL]
where XX is the language code.
 

dutchbb

Well-known member
Anyone an idea how to remove these?

<HR style= (junk in between) SIZE=1>

<TABLE class= (junk in between) </TABLE>

<ACRONYM title= (junk in between) </ACRONYM>

Between acronym there is some usefull content so i could use bbcode for it (no idea how). Between table class also (before last TD), but most of them can be removed completly because almost impossible to get it out like you can see in the example.

Code:
<hr style="color: rgb(209, 209, 225); background-color: rgb(209, 209, 225);" size="1">

<TABLE class="vtop default"><TBODY><TR><TD class=field>Naam: </TD><TD>Bekend bij de politie</TD></TR></TBODY></TABLE>

<acronym title="deca-durabolin">deca</acronym>
Table class example
Code:
<table class="tborder" style="border-bottom-width: 0px;" align="center" border="0" cellpadding="6" cellspacing="1" width="100%"> <tbody><tr> <td class="tcat" width="100%"> Wie Heeft Mij Gequoot? - Top Quoters </td> </tr> </tbody></table> <table class="tborder" align="center" border="0" cellpadding="6" cellspacing="1" width="100%"> <tbody><tr align="center"> <td class="thead" align="center" nowrap="nowrap">Gebruiker</td> <td class="thead" align="center" width="50%" nowrap="nowrap">Totaal</td> </tr> <tr align="center"> <td class="alt1" align="center">,</td> <td class="alt1" align="center" nowrap="nowrap">546</td> </tr> <tr align="center"> <td class="alt2" align="center">,</td> <td class="alt2" align="center" nowrap="nowrap">122</td> </tr> <tr align="center"> <td class="alt1" align="center">,</td> <td class="alt1" align="center" nowrap="nowrap">96</td> </tr> <tr align="center"> <td class="alt2" align="center">,</td> <td class="alt2" align="center" nowrap="nowrap">94</td> </tr> <tr align="center"> <td class="alt1" align="center">,</td> <td class="alt1" align="center" nowrap="nowrap">71</td> </tr> <tr align="center"> <td class="alt2" align="center">,</td> <td class="alt2" align="center" nowrap="nowrap">68</td> </tr> <tr align="center"> <td class="alt1" align="center">,</td> <td class="alt1" align="center" nowrap="nowrap">68</td> </tr> <tr align="center"> <td class="alt2" align="center">,</td> <td class="alt2" align="center" nowrap="nowrap">61</td> </tr> <tr align="center"> <td class="alt1" align="center">,</td> <td class="alt1" align="center" nowrap="nowrap">60</td> </tr> <tr align="center"> <td class="alt2" align="center">,</td> <td class="alt2" align="center" nowrap="nowrap">60</td> </tr> </tbody></table>
 
Last edited:

dutchbb

Well-known member
And found it. Only need a replace for acronym
Code:
/\<hr style=[^\]]+?\ size="1">/i

/\<acronym title=[^\]]+?\<\/acronym>/i

/\<TABLE class=[^\]]+?\<\/TABLE>/i
Edit: and found, this one only removes acronym and leaves the words in between.
Code:
/\<acronym title=|<\/acronym>/i
I am using this for testing btw
http://www.rubular.com/
 
Last edited:

Alfa1

Well-known member
@Triops you can do this with a database query.

UPDATE xf_post SET message = REPLACE(message, '[IMGpreview=550]', '[IMG]');

UPDATE xf_post SET message = REPLACE(message, '[/IMGpreview]', '[/IMG]');

Make sure to take a backup first.
 

Triops

Well-known member
You are so right, always think of the simpliest version! And to find the diffrent dimensions I could just select before with like "imgpreview=%"...
 
Can anyone help with regex for this please?:

[url=http://www.youtube.com/watch?v=FbNLZbljNIw]YouTube - How To Create Animated GIFs In Photoshop CS4[/url]

Seems fairly common but I couldn't find anything that worked in this thread.
 

Chris D

XenForo developer
Staff member
Try:
Code:
/\[url=https*?:\/\/(?:www\.)*+youtu\.*?be.com\/watch\?v=([\w\-]+)\].*\[\/url\]/is
Remember to try and test these as thoroughly as you can and make backups!
 
Try:
Code:
/\[url=https*?:\/\/(?:www\.)*+youtu\.*?be.com\/watch\?v=([\w\-]+)\].*\[\/url\]/is
Remember to try and test these as thoroughly as you can and make backups!
Thanks @Chris D - that works for most of them, however it's catching some other bits of text and sometimes large portions of posts.

Using:
Code:
Quick Find: [url=http://www.youtube.com
Regular Expression: /\[url=https*?:\/\/(?:www\.)*+youtu\.*?be.com\/watch\?v=([\w\-]+)\].*\[\/url\]/is
Replacement string:[media=youtube]\1[/media]
90% of results look perfect, however here are some examples where it's catching more than what is inside the URL tags. Looks like it's an issue when there is more than one YouTube video in a post:

Code:
[url=http://www.youtube.com/watch?v=PwwNVAJV1Vg]YouTube - The German Sheppard that saved me from becoming a pile of ash[/url] ,[/SIZE][/FONT] [SIZE=3][FONT=Times New Roman] i'm confined to a wheelchair 24/7. I was on Youtube the other day, just searching for some really KEWL music and found this video.. [url=http://www.youtube.com/watch?v=IHAoDTyYwy0]YouTube - Jaili Lama's STUNNING WORK!!![/url][/FONT][/SIZE] [FONT=Times New Roman][SIZE=3]I found this person on Facebook, and he gave me the link to the song (WONDERFUL MUSIC!) but he said that he wont tell me how to create these photos.. I'm a self taught Photoshop aficionado... Using Photoshop is just like learning to write... eventually you do it so much, that it just becomes second nature, I dont know how much time I have left or I would try to teach myself like I did with Swapping Faces. [url=http://www.youtube.com/watch?v=-9PSpjamKbk]YouTube - Swapping faces #18[/url]
Code:
[url=http://www.youtube.com/watch?v=FMycbFnegvU]YouTube - Photoshop Tutorial - Comic Book Effect Part 1[/url] pt 1 [url=http://www.youtube.com/watch?v=KsegYz4iAow]YouTube - Photoshop Tutorial - Comic Book Effect Part 2[/url]
Code:
[url=http://www.youtube.com/watch?v=fXdZIeMmQIo]YouTube - M.Jackson Adobe Photoshop Quick tutorial Combining Images: The Virtual ***** Reduction[/url] [url=http://www.marshajackson.carbonmade.com]The New York State of Mind 2008-2010[/url]