Partage
  • Partager sur Facebook
  • Partager sur Twitter

Probleme Regex

    27 novembre 2005 à 18:14:55

    Salut !

    Voila quand je fais

    Citation : .

    <h5></h5>



    Sa me renvoie :


    Citation : .

    <n style="color:RED"><n style="color:RED"><<n><n style="color:RED">h5><<n><n style="color:RED">b<n><<n><n style="color:RED">spa<n style="color:RED">r<n><n style="color:RED"> /> <n><n style="color:RED"> n>h<n>5>




    Avec ces Regexs :


    Citation : .

    <?php
    // Coloration HTML
    // <>
    $html = preg_replace('!.+(\<).+!isU', '<span style="color:RED">$0</span>', $html);
    $html = preg_replace('!.+(\>).+!isU', '<span style="color:RED">$0</span>', $html);

    // Tableau
    // table
    $html = preg_replace('!\<(table).+!isU', '<span style="color:#FF9900">$0</span>', $html);
    // th
    $html = preg_replace('!\<(th).+!isU', '<span style="color:#FF9900">$0</span>', $html);
    // tr
    $html = preg_replace('!\<(tr).+!isU', '<span style="color:#FF9900">$0</span>', $html);
    // td
    $html = preg_replace('!\<(td).+!isU', '<span style="color:#FF9900">$0</span>', $html);

    // Texte
    // b
    $html = preg_replace('!\<(b).+!isU', '<span style="color:#66CC33">$0</span>', $html);
    // i
    $html = preg_replace('!\<(i).+!isU', '<span style="color:#66CC33">$0</span>', $html);
    // u
    $html = preg_replace('!\<(u).+!isU', '<span style="color:#66CC33">$0</span>', $html);
    // p
    $html = preg_replace('!.+(p).+!isU', '<span style="color:#0000CC">$0<</span>', $html);

    // Titres
    // h
    $html = preg_replace('!\<(h6|h5|h4|h3|h2|h1).+!isU', '<span style="color:#FF00FF">$0</span>', $html);
    ?>




    D'ou vien le probleme ?

    Merci ! :)

    • Partager sur Facebook
    • Partager sur Twitter

    Probleme Regex

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown