note 11561 deleted from ereg_replace by ronabop
| From: | ronabop@php.net | Date: | Mon, 05 Mar 2001 01:07:29 +0000 |
| Subject: | note 11561 deleted from ereg_replace by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11854@lists.php.net to get a copy of this message | ||
I've been trying to, after a search, place "<span
class=classname>$string</span>"
I can do that easily enough but the problem is it replaces that $string is also replaced inside
other markers.
eg : if $string = "image"; then it also makes <IMG SRC=images/name.gif> into <IMG
SRC=<span>image</span>s/name.gif>
I tried playing around with ereg_replace but could only come up with the following
$rep = "a|e|!";
$newstring = eregi_replace(">([^<>]*)($rep)([^<>]*)<",
">\1<b>\2</b>\3<", "<>a asdf asdf a a<asdf asdf
asdf>h>el<l>o!!!<asdf asd f>");
print $newstring;
This puts bold anything in $rep but only seems to do it to the last instance. For example it will
only make bold the 3rd 'a' in the string as well as the 'e' and the third
'!'.
Can anyone help me?!