Hi

I have the script below which encases every occurance of span in a <span>
tag

The problem is I don't want it to replace any occurance of span that is
inside a tag.
how could I acheive this?
I'm using perl regular expressions to keep the original case of the string.
So, how could I replace occurances of span that aren't in a tag?

Many thanks

M@ ' my regular expressions book is in the post
#################################################################
<style type="text/css">
<!--
.message {color: #FF0000;}
-->
</style>
<?php

$string = "<span class=message>span, span the span</span>";
echo $string.NL;
$search = array("span");
echo "Count = ".count($search).NL;
for($i=0;$i < count($search); $i++)
{
        $result =$string;
        if(next($search) == false)
        {
                reset($search);
        }
                $bgstring = current($search);
                        $result = preg_replace("/($bgstring+)/ie", "'<b>\\1</b>'", 
$result);

}
        echo $result;
?>
################################################################


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to