#22371 [Opn->Fbk]: ereg_replace moving ! to start of string
| From: | iliaa@php.net | Date: | Sat, 22 Feb 2003 20:15:48 +0000 |
| Subject: | #22371 [Opn->Fbk]: ereg_replace moving ! to start of string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33929@lists.php.net to get a copy of this message | ||
ID: 22371
Updated by: iliaa@php.net
Reported By: phpbugreport at webfroot dot co dot nz
-Status: Open
+Status: Feedback
Bug Type: Regexps related
Operating System: Windows XP
PHP Version: 4.3.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
With latest CVS I get:
bacon <a href='http://www.whatever.com'>hello</a>
as the result of the regular expression.
Previous Comments:
------------------------------------------------------------------------
[2003-02-22 01:22:55] phpbugreport at webfroot dot co dot nz
Running Apache 1.3 as a service on Windows XP
$text = ereg_replace ("<a[^>]+href *= *([^ ]+)[^>]*>", "<a
href=\\1>",
$text);
The above line of code is supposed to find all a tags and strip any
attributes except href. However:
$text = "bacon <a href='http://www.whatever.com'
title='hello!'>hello</a>";
will be set to:
bacon !<a href='http://www.whatever.com'
title='hello'>hello</a>
How in the hell did that exclaim get to the start of the a tag? Maybe
I'm just doing something wrong, but it looks like a bug to me.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22371&edit=1