Jump to content

[SOLVED] Correct code and execution???


Tboy_forum

Recommended Posts

Hi all

 

I have the following in a sql database which I need fixing (added www.**** for obvious resons  ;D:

 

[img:::119f8aa6a7]http://www.******.com/talk/phpBB2/userpix/2123_scorp2_2.jpg[/img:119f8aa6a7]

[img:::119f8aa6a7]http://www.******.com/talk/phpBB2/userpix/2123_pipedream2_1.jpg[/img:119f8aa6a7]

[img:::50ef365145]http://img.photobucket.com/albums/******/Franschoek%20270108/vulturebike.jpg[/img:50ef365145]

[img:::50ef365145]http://img.photobucket.com/albums/******/Franschoek%20270108/svmarinda.jpg[/img:50ef365145]

[img:::50ef365145]http://img.photobucket.com/albums/******/Franschoek%20270108/silversv.jpg[/img:50ef365145]

[img:::50ef365145]http://img.photobucket.com/albums/******/Franschoek%20270108/scorpbike.jpg[/img:50ef365145]

[img:::50ef365145]http://img.photobucket.com/albums/******/Franschoek%20270108/pdbike.jpg[/img:50ef365145]

[img:::b38af58107]http://www.******.com/talk/phpBB2/userpix/2123_DSCF4356_1.jpg[/img:b38af58107]

[img:::b38af58107]http://www.******.com/talk/phpBB2/userpix/2123_DSCF4320_1.jpg[/img:b38af58107]

 

Is this code correct for finding the above???: Its not doing anything and the mixed pattern is confusing

 

I am trying to strip the eg:

'[img:::b38af58107]' (without quotes)

 

to a normal image code 

[img]

 

 

 

$text = preg_replace('#\[img:([a-z0-9]http://+)\](.*)\[/img:\\1\]#siU', '[img=$2]', $text);  

 

Many thanks

Link to comment
https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/
Share on other sites

<?php
$text = '[img:160:120:ef49b298be]http://i6.photobucket.com/albums/*****/Mystic_Mark/Photo-0119.jpg[/img:ef49b298be]';
$text = preg_replace('#\[(/?)img:.*?\]#si', '[$1img]', $text);
echo $text;
?>

return

[img=http://i6.photobucket.com/albums/*****/Mystic_Mark/Photo-0119.jpg]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.