Posted by Janwillem Borleffs on 12/27/05 13:12
jc wrote:
> Could anyone help me to write a function which would chanfe the
> string like this:
>
> "content [foto 1 l] content content content content[foto 3 f] etc
> [foto 21 r]"
> into
> "content <img src="img/1.jpg class="l"> content content content
> content<img src="img/3.jpg class="f"> etc <img src="img/21.jpg
> class="r">"
$content = preg_replace(
'/\[foto\s*(\d+)\s*([^]])\]/',
'<img src="img/$1.jpg class="$2">',
$content
);
JW
[Back to original message]
|