Thanks for quick reply. But my problem does not solve yet. The text [b]{{img=[/b] should be replaced with [b]<img src[/b] and [b]}}[/b] with [b]>[/b] So the following text [quote]This is an image {{img='http://path/to/image/imagename.jpg' border='0' width='100' alt='Alternate text'}} and this is another image {{img='http://path/to/image/imagename.png' border='0' width='100' alt='Alternate text'}}...blah blah blah...[/quote] should be look like [quote]This is an image <img src='http://path/to/image/imagename.jpg' border='0' width='100' alt='Alternate text'> and this is another image <img src=='http://path/to/image/imagename.png' border='0' width='100' alt='Alternate text'>...blah blah blah...[/quote] But when I used your code: [quote]$str = "This is an image {{img='http://path/to/image/imagename.jpg' border='0' width='100' alt='Alternate text'}} and this is another image {{img='http://path/to/image/imagename.png' border='0' width='100' alt='Alternate text'}}...blah blah blah..."; $test = preg_replace('|\{\{img(.+?)\}\}|i', "<img$1 />", $str); print_r( $test);[/quote] I got the result like [quote]This is an image and this is another image ...blah blah blah...[/quote] I think, I can clarify my problem now. Thanks