ID: 24645 User updated by: nek at capsule dot org Reported By: nek at capsule dot org Status: Bogus Bug Type: Regexps related Operating System: Linux PHP Version: 4.3.1 New Comment:
doh... tab then return = submit form.. sorry i said : <?php $newsaff = "<A HREF=\"JAVASCRIPT:COMMENT()\">THIS IS A TEST LINK</A>"; $newsaff = ereg("HREF=\"([^\"]+)\"",$newsaff,$newsreplace); for ($i=1;$i<sizeof($newreplace);$i++) { $newsaff = str_replace($newreplace[$i],strtolower($newreplace[$i]),$newsaff); } print $newsaff; ?> maybe there's a simplier solution, that's coded from scratch ;) but yes indeed, that's complicated and a non bogus ereg_replace would be from great help :) thanks Previous Comments: ------------------------------------------------------------------------ [2003-07-14 09:39:50] nek at capsule dot org you mean something like : <?php $newsaff = "<A HREF=\"JAVASCRIPT:COMMENT()\">THIS IS A TEST LINK</A>"; $newsaff = ereg("HREF=\"([^\"]+)\"",$newsaff,$newsreplace); for ($i=1;$i<sizeof($newreplace);$i++) print $newsaff; ?> ------------------------------------------------------------------------ [2003-07-14 09:21:06] [EMAIL PROTECTED] That's correct, so this is bogus. Try using ereg()/preg_match() with the optional registers used in the third argument to get the results you're looking for. J ------------------------------------------------------------------------ [2003-07-14 09:19:55] nek at capsule dot org well, maybe the matching string should be considered as a normal one, so we can use some functions on it. this would render ereg_replace function even more powerfull, isn't it ? ------------------------------------------------------------------------ [2003-07-14 09:09:01] b_ulrich at t-online dot de Using strtolower("HREF=\"\\1\"") as parameter is like using "href=\"\\1\"" directly. First the strtolower is processed and then that result is used as parameter. You have to change your search/replace pattern to get what you want. The function works correct. ------------------------------------------------------------------------ [2003-07-14 08:39:01] nek at capsule dot org sorry, it's php 4.3.1 and not 4.3.2 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24645 -- Edit this bug report at http://bugs.php.net/?id=24645&edit=1