#22732 [NEW]: eregi_replace function does not find all appearences in a string

From: Date: Sun, 16 Mar 2003 00:29:47 +0000
Subject: #22732 [NEW]: eregi_replace function does not find all appearences in a string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-35682@lists.php.net to get a copy of this message
From:             ofjord at simnet dot is
Operating system: windows nt
PHP version:      4.3.0
PHP Bug Type:     *General Issues
Bug description:  eregi_replace function does not find all appearences in a string

I want to parse a HTML document to replace all links to .htm documents so
that the .htm document becomes a parameter in a php script.

Here is the code to replace the links:

  $text = eregi_replace("href=(\")?(.*[.]htm)(\"?)",
"href=\\1template1.php?file=\\2\\3", $text);

This works fine, but only once in each document. This text:

<B>&#149;</B> <a
href="ferdatjon_fyrirt_gisting.htm">Gisting</a><BR><BR>
<B>&#149;</B> <a
href="ferdatjon_fyrirt_handverkshus.htm">Handverkshús</a><BR><BR>

returns:

<B>&#149;</B> <a
href="template1.php?file=ferdatjon_fyrirt_gisting.htm">Gisting</a><BR><BR>
<B>&#149;</B> <a
href="ferdatjon_fyrirt_handverkshus.htm">Handverkshús</a><BR><BR>

Is this a bug?

-- 
Edit bug report at http://bugs.php.net/?id=22732&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22732&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22732&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22732&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22732&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22732&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22732&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22732&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22732&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22732&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22732&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22732&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22732&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22732&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22732&r=gnused



Thread (3 messages)

« previous php.bugs (#35682) next »