Re: preg_replace
| From: | Oliver Ruf | Date: | Thu, 04 Oct 2001 16:49:31 +0000 |
| Subject: | Re: preg_replace | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69953@lists.php.net to get a copy of this message | ||
It worked !!
Thank you very much for your help!
- Yours, Oliver
pgerzson@freestart.hu (Papp Gyozo) wrote in
news:003701c14cf0$d7363300$01fdfea9@jaguar:
> $text = "[LINK image.png]MyImage[/LINK]";
> $out = preg_replace ("|\[LINK(.*)\](.*)\[/LINK\]|iU", '<a
> href="\1">\2</a>',$text);
>
> I hope, I don't forget anything.
>
>
> ----- Original Message -----
> From: "Oliver Ruf" <rufus0815@yahoo.com>
> To: <php-general@lists.php.net>
> Sent: Thursday, October 04, 2001 4:23 PM
> Subject: [PHP] preg_replace
>
>
>> Hello
>>
>> I'm trying to write some kind of parser... see the example:
>>
>> $text = "[LINK image.png]MyImage[/LINK]";
>>
>> $out = preg_replace ("/\[LINK*\]*\[/LINK\]/i", "/<a
>> href=\"*\">*</a>/",$text);
>>
>> Well... What I would like is, that $out would be something like about
>> this: "<a href="image.png">MyImage</a>"
>>
>>
>> But this somehow doesn't work because Regexp don't seem to be supported
>> for the replacement string...
>>
>> Any idea ??
>> Thx, Oliver
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>> For additional commands, e-mail: php-general-help@lists.php.net
>> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>
>
>