In article <[EMAIL PROTECTED]>, Olinux O wrote:

>What I'm doing is using ereg_replace in this form:
>$LargeString = ereg_replace("<tag>.*</tag>",
>"replacement", "$LargeString");
>but what I get is the string with the replacement in a
>way I don't actually want. It replaces the part of the
>string that begins with THE FIRST TAG <tag> and that
>ends with THE LAST TAG </tag>. 


Dunno of its helping but we had a simular prob. I wrote a small class that
allows us to check for allowed tags.

<code>

          ........ class declarations .........

    $allowedtags = array    (

                    '<br>'      => '[br]',
                    '<p>'       => '[p]',
                    '</p>'      => '[/p]',
                    '<strong>'  => '[strong]',
                    '</strong>' => '[/strong]',
                    '<b>'       => '[b]',
                    ....... etc.......


        while ( list ($key, $val)  = each($allowedtags)) {
            $trans = str_replace ($key, $val, $trans);
        }

        $trans = strip_tags(stripslashes($trans));

        reset($allowedtags);

        while ( list ($key, $val)  = each($allowedtags)) {
            $trans = str_replace ($val, $key, $trans);
        }

        return $trans;
</>

Regards,

Hans



-- 
PHP Database 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