| re: eregi_replace: why doesn´t this work?
Florian Leeber wrote:[color=blue]
> function do_bug_link($in)
> {
>
> return eregi_replace("\!([0-9]+)","<a
> href='bug.php?op=show&bugid=\\1'>Bug \\1</a>",$in);
> }
>
> which should substitue all occurences in my $in like the following:
>
> Blah text !123 blah text => Blah text <a
> href='bug.php?op=show&bugid=123'>Bug 123</a> blah text
>
> it works, partially....
>
> output is:
> Blah text <a href='bug.php?op=show&bugid=123'>Bug <a
> href='/bug.php?op=show&bugid=123'>123</a></a>
>
> why is this called recursively at the second \\1 ???[/color]
It works as expected for me.
$ php -v
PHP 4.3.3 (cli) (built: Nov 19 2003 23:12:29)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
Anyway ... switch to preg_(); they are more powerfule and faster than
their ereg* counterparts.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =-- |