Visualizzazione dei risultati da 1 a 3 su 3

Discussione: RegeXp e HTML

  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    957

    RegeXp e HTML

    Ciao a tutti,
    avendo questo testo:

    codice:
            <tr class="product_table_intestazione">
                <td colspan="3">Lunghezze in mm.</td>
            </tr>
            <tr>
                <td colspan="3">1000,750,500,250</td>
            </tr>
    come faccio a fare un preg_match_all che mi di le righe ad una ad una, quindi con
    array(
    '<td colspan="3">Lunghezze in mm.</td>',
    '<td colspan="3">1000,750,500,250</td>'
    )

    perchè attualmente essendoci più <TR> mi da un blocco unico:
    codice:
                <td colspan="3">Lunghezze in mm.</td>
            </tr>
            <tr>
                <td colspan="3">1000,750,500,250</td>
    grazie!

  2. #2
    prova così:

    Codice PHP:
    // $in xml fai leggere il file con i tag html
    $buff explode("</tr>"$xml);

    // elimina l'ultimo
    array_splice ($buffcount($buff)-1);
            
    // svuota la var
    $buffelement "";
            
    // crea un nuovo array
    $newbuff = array();
            
    // per ogni elemento in $buff
    foreach($buff as $buffelement){
        
    // mette i tag in newbuff
        
    $newbuff[] = eregi_replace("^.*(\<tr\>|\<tr [^>]+\>)","",ltrim($buffelement));
    }

    print_r($newbuff); 

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    957
    ok grazie, proverò.
    Speravo ci fosse un sistema con i regexp... mi sembra una cosa così... normale!

    Grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.