Posted by Ac1d^ on 09/12/06 09:40
gehegeradeaus@gmail.com napisal(a):
> Can someone help me to make a regular expression for this sort of
> replacement :
>
> text with {link:pagehref}a link{/link}.
>
> replace to ->
>
> text with <a href="pagehref">a link</a>
>
> I tried several things but nothing seems to work... e.g.
>
> $value=preg_replace("/\{link\:(.+?)\}(.+?)\{\/link\}/s","<a href=\"$1\"
> target=\"_blank\">$2</a>",$value);
>
> Thanks in advance!
Try this pattern.
"/\{link\:(.*)\}(.*)\{\/link\}\s/"
rest of the code looks fine.
You can also have a look at the comments below preg-replace Description
at www.php.net. There is a lot of usefull informations how to use it,
http://uk2.php.net/manual/en/function.preg-replace.php
Navigation:
[Reply to this message]
|