Tboy_forum Posted May 25, 2008 Share Posted May 25, 2008 Hi all I have the following in a sql database which I need fixing (added www.**** for obvious resons : [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 Quote Link to comment https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/ Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 $text = preg_replace('#\[(/?)img:.*?\]#si', '[$1img]', $text); Quote Link to comment https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/#findComment-549766 Share on other sites More sharing options...
Tboy_forum Posted May 25, 2008 Author Share Posted May 25, 2008 Thanks But still getting the following result (***** added for obvious reasons): :( Signature done -> [img:160:120:ef49b298be]http://i6.photobucket.com/albums/*****/Mystic_Mark/Photo-0119.jpg[/img:ef49b298be] Quote Link to comment https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/#findComment-549776 Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 <?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] Quote Link to comment https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/#findComment-549784 Share on other sites More sharing options...
Tboy_forum Posted May 25, 2008 Author Share Posted May 25, 2008 Hmmmm.. Just tested with phpDesigner and it does work - will have to go and look why it isn't executing in my file Thanks for that Quote Link to comment https://forums.phpfreaks.com/topic/107229-solved-correct-code-and-execution/#findComment-549788 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.