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
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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.