Resource icon

Post Content Find / Replace 1.0.0

No permission to download
Hello,

I was wondering how to replace [SOMETHING] with [SOMETHINGdifferent].

I have tried [SOMETHING] as the regular expression with no success.

Thanks!

When constructing a regular expression you need to use delimiters for one thing (they define the beginning and end of the expression #EXPRESSION#, and then when you want/need to you can also set flags #EXPRESSION#i, lowercase i meaning case insensitive)

and in regex [] defines a character class , [0-9]+ for example means any amount of any digits...if you want to match a literal [ you need to escape it so when the regex is interpreted it sees a character instead of the opening of a character class like this \[

#\[SOMETHING]#siu
 
Is it possible to use this to replace all thumbnails with full size images?

all instances of
Code:
[ATTACH]XXXXX.vB[/ATTACH]

changed to

[ATTACH=full]XXXXX[/ATTACH]

where XXXXX is the attachment number
 
Last edited:
Is it possible to use this to replace all thumbnails with full size images?

all instances of
Code:
[ATTACH]XXXXX.vB[/ATTACH]

changed to

[ATTACH=full]XXXXX[/ATTACH]

where XXXXX is the post number
Are you sure that your attachments have been imported and that the id for each attachment correlate between the two software titles?
 
and is that .vb actually in your current posts or is that just something you added to the attachment id in the post here to denote that it is the post as it exists now from your vb import?

I have about 10,000 posts that after importing from vBulletin into my new XenForo installation are showing thumbnails where the full sized images were originally in vBulletin. All the attachment files were transferred during the import, so all the images are still there, just too small.

If I open the post to edit, and look at code, I see the attachment as
Code:
[ATTACH]XXXXX.vB[/ATTACH]

if I remove the .vb and change
Code:
[ATTACH]XXXXX.vB[/ATTACH]
to
Code:
[ATTACH=full]XXXXX[/ATTACH]
everything is good.

I just noticed that I made an error in my original post and just corrected it - the XXXXX refers to the ATTACHMENT number not the post number.
 
You should test this first...I don't have time to make tons of test posts ATM.



Quick Find:
Code:
attach

Regular expression:
Code:
#(\[ATTACH)(])(.*?(?!\[/ATTACH]?))(\.vb)(\[/ATTACH])#siu

Replacement String:
Code:
\1=full\2\3\5
 
Quick Find:
Code:
amazon

Regular expression:
Code:
#http://www\.amazon\.de/dp/[^/]+/\?tag=AMAZON-ID#siu

Replacement String:
Code:
[URL]\0[/URL]

Sorry @EQnoble
I found a new and better BBCode for Amazon with pictures from the products and without iframes.

This is the current code:
Code:
[URL]http://www.amazon.de/dp/1234567890/?tag=AMAZON-ID[/URL]

I need this:
Code:
[AMAZON]1234567890[/AMAZON]
 
Tested, verified, executed, completed successfully, thanks for saving me about 6 months of 10-hours-a-day manual edits.
:eek:Please don't talk about time...it's the one thing that is killing me right now and that right there sir, just sounds depressing. 6 less months of the bull is six more of the foro. Regex FTMFW! (y)

Thanks for letting me know.

Sorry @EQnoble
I found a new and better BBCode for Amazon
Ouch

This is the current code:
Code:
[URL]http://www.amazon.de/dp/1234567890/?tag=AMAZON-ID[/URL]

I need this:
Code:
[AMAZON]1234567890[/AMAZON]

http://xenforo.com/community/resources/amazon-parser-all.2911/

Shouldn't this work for you?
 
Need to turn

Code:
 (<u><a href="http://insidestocks.com/chart.asp?sym=XXXXX&code=BCMM" target="_blank">XXXXX</a></u>) <i>(XXXXX)</i>

into this

Code:
([U][URL='http://insidestocks.com/chart.asp?sym=XXXXX&code=BCMM']XXXXX[/URL][/U]) [I](XXXXX)[/I]
 
Last edited:
It also works, but I need pictures.
Can you help me please?
I don't quite understand what you mean by 'I need pictures'.

What is the actual problem that you are having?






Need to turn
Code:
 (<u><a href="http://insidestocks.com/chart.asp?sym=XXXXX&code=BCMM" target="_blank">XXXXX</a></u>) <i>(XXXXX)</i>
into this
Code:
([U][URL='http://insidestocks.com/chart.asp?sym=XXXXX&code=BCMM']XXXXX[/URL][/U]) [I](XXXXX)[/I]
Again this is untested as I don't have the time to make a boatload of tests at the moment but from first glace I believe this should fit for you.


A note from me said:
It will match the following with BLAH being the different captured groups of relevance.
(<u><a href="BLAH" target="_blank">BLAH</a></u>) <i>(BLAH)</i>






Quick Find:
Code:
insidestocks

Regular expression:
Code:
#\(<u>(?:<a href="([^"]+)")[^>]+>(.*?(?!</a>?)?.)</a></u>\)(?:[^<]+)?<i>(.*?(?!</i>?)?)</i>#siu

Replacement String:
Code:
([u][url='\1']\2[/url][/u]) [i](\3)[/i]
 
Last edited:
I don't quite understand what you mean by 'I need pictures'.
What is the actual problem that you are having?

But I wrote my problem.

This is the current code:
Code:
[URL]http://www.amazon.de/dp/1234567890/?tag=AMAZON-ID[/URL]

I need this:
Code:
[AMAZON]1234567890[/AMAZON]
 
What bbcode is this for? (link)
It's the old vBulletin BBCode. The same from @Janmaat

http://www.xendach.de/resources/amazon-bb-code-by-janmaat.145/
Code:
<br>
<table border="0" cellspacing="4" cellpadding="0">
<tr>
<td><a href="http://www.amazon.de/exec/obidos/ASIN/{text}/xxx-21" target="_blank"><img src="http://images-eu.amazon.com/images/P/{text}.03.MZZZZZZZ.jpg" border="0"></a></td>
</tr>
<tr>
<td><strong>ASIN</strong>: <a href="http://www.amazon.de/exec/obidos/ASIN/{text}/xxx-21" target="_blank">{text}</a></td>
</tr>
</table>
<br>
 
It's the old vBulletin BBCode. The same from @Janmaat

http://www.xendach.de/resources/amazon-bb-code-by-janmaat.145/
Code:
<br>
<table border="0" cellspacing="4" cellpadding="0">
<tr>
<td><a href="http://www.amazon.de/exec/obidos/ASIN/{text}/xxx-21" target="_blank"><img src="http://images-eu.amazon.com/images/P/{text}.03.MZZZZZZZ.jpg" border="0"></a></td>
</tr>
<tr>
<td><strong>ASIN</strong>: <a href="http://www.amazon.de/exec/obidos/ASIN/{text}/xxx-21" target="_blank">{text}</a></td>
</tr>
</table>
<br>
Try this


Quick Find:
Code:
amazon
Regular expression:
Code:
#\[url](?:http://(?:www\.)?(amazon)\.(?:[a-z]+|[a-z]+\.[a-z]+)\/)(?:gp/offer-listing|gp/product|dp|exec/[a-z0-9]+/[a-z0-9]+/[a-z0-9]+)/([a-z0-9]+)/(?:[^\[]+)?\[/url]#siu
Replacement String:
Code:
[\1]\2[/\1]
 
Try this


Quick Find:
Code:
amazon
Regular expression:
Code:
#\[url](?:http://(?:www\.)?(amazon)\.(?:[a-z]+|[a-z]+\.[a-z]+)\/)(?:gp/offer-listing|gp/product|dp|exec/[a-z0-9]+/[a-z0-9]+/[a-z0-9]+)/([a-z0-9]+)/(?:[^\[]+)?\[/url]#siu
Replacement String:
Code:
[\1]\2[/\1]
It works fantastic!
Thx!
 
...Again this is untested as I don't have the time to make a boatload of tests at the moment but from first glace I believe this should fit for you.

Quick Find:
Code:
insidestocks

Regular expression:
Code:
#\(<u>(?:<a href="([^"]+)")[^>]+>(.*?(?!</a>?)?.)</a></u>\)(?:[^<]+)<i>(.*?(?!</i>?)?)</i>#siu

Replacement String:
Code:
([u][url='\1']\2[/url][/u]) [i](\3)[/i]

I get this

Server Error
preg_match_all(): Compilation failed: nothing to repeat at offset 45

  1. XenForo_Application::handlePhpError()
  2. preg_match_all() in PostReplace/ControllerAdmin/PostReplace.php at line 26
  3. PostReplace_ControllerAdmin_PostReplace->actionReplace() in XenForo/FrontController.php at line 347
  4. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  5. XenForo_FrontController->run() in /var/www/vhosts/onlinetradersforum.com/httpdocs/admin.php at line 13
 
I get this

Server Error
preg_match_all(): Compilation failed: nothing to repeat at offset 45

  1. XenForo_Application::handlePhpError()
  2. preg_match_all() in PostReplace/ControllerAdmin/PostReplace.php at line 26
  3. PostReplace_ControllerAdmin_PostReplace->actionReplace() in XenForo/FrontController.php at line 347
  4. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  5. XenForo_FrontController->run() in /var/www/vhosts/onlinetradersforum.com/httpdocs/admin.php at line 13
I just ran a quick test and it appears to work for me, unless you accidentally threw a stray character in there I would need to test it really quick on your server.


sgfgfdf.webp

For now I made a small edit to the original post that you quoted so go back to that and see if that edit works for you now. If that change didn't catch it I would need to take a look at from your site myself. Try it again and let me know what you get.
 
Back
Top Bottom