<?php 
include_once('../preg_magic.php'); 
 
$HistoryFields = array( 
    'cardnumber'    => 'card number:<\/span>\s*((?:\d{4}\s*){3}\d{4})', 
    'balance'       => 'Card balance:<\/td>\s*<td>\s*(\$\d+\.\d+)', 
    'history'       => array( 
        '@table'        => true, 
        '@table_start'  => 'class="results_table">.+?<\/tr>\s*', 
        '@table_end'    => '\s*<\/table>', 
        '@table_fields' => array( 
            'stamp'        => '\s*<tr class="(?:odd|even)">\s*' 
                              . '<td>(\d+-\w+-\d+\s*\d+:\d+\s*\w+)<\/td>', 
            'type'         => '<td.*?>\s*([^<]*?)\s*<\/td>', 
            'location'     => '<td.*?>\s*([^<]*?)\s*<\/td>', 
            'amount'       => '<td.*?>\s*([^<]*?)\s*<\/td>', 
            'gst'          => '<td.*?>\s*([^<]*?)\s*<\/td>\s*<\/tr>\s*' 
        ) 
    ) 
); 
 
$HistoryHTML = preg_replace("/\s\s+| /",' ',file_get_contents('history.html')); 
 
$Output = preg_magic::execute($HistoryFields, $HistoryHTML); 
 
print_r($Output);
 
 |