"Yz James" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey John,
> something like this might work:
>
> <?
>
> $string = "This is a string with an embedded image [bird.gif,this is a
> bird]";
>
> $string = preg_replace("/\[(.*?\.)(gif|jpg),(.*?)\]/i", "<img
src=\"\\1\\2\"
> alt=\"\\3\">", $string);
>
> echo $string;
>
> ?>
Great!. I love it when I see stuff like this written by someone
who knows regex better than I. The ability to insert the
pieces that are recognized/extracted via \1, \2 is pretty cool.
Thanks.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]