This is a discussion on eregi_replace: why doesn´t this work? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi! I try to: function do_bug_link($in) { return eregi_replace("\!([0-9]+)","<a href='bug.php?op=...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi!
I try to: 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 ??? TIA, F. Leeber |
|
|||
|
"Florian Leeber" <fleeber@ghl.at> schreef in bericht news:vZpCb.27113$dt3.13388@news.chello.at... > > 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 ??? > Not sure what you are passing the function as an argument, but the following works for me: function do_bug_link($in) { return eregi_replace( "\!([0-9]+)", "<a href='bug.php?op=show&bugid=\\1'>Bug \\1</a>", $in ); } echo do_bug_link("Blah text !123 blah text"); JW |