View Single Post
Old 12-04-2007, 08:17 AM   #3 (permalink)
Sam Granger
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

Quote:
Originally Posted by SOCK View Post
Are we assuming the string will always be the same, e.g. some text embedded within image tags with image names?

Use a regular expression to weed out anything between and including the opening and closing [ image ] tags.
Thanks!

Like so?

PHP Code:
$searchfor = array(
    
'#\[rightimage\](.*?)\[/rightimage\]#',
    
'#\[image\](.*?)\[/image\]#'
);
$replacewith = array(
    
'',
    
''
);
return 
preg_replace($searchfor $replacewith$text); 
Sam Granger is offline  
Reply With Quote