Generalnie parsowanie htmla z użyciem regexp to złooooooo. Poczytaj sobie
http://stackoverflow.com/questions/1732348...-contained-tags, dość zabawny post

Nie znaczy to, że jest to niemożliwe. Dla Twojego przypadku napisałem mały skrypt. Pierwsza funkcja, jako pierwszy parametr pobiera ten Twój html, który zamieściłeś w poście wyżej, drugi parametr to będzie tag
tr, a trzeci to tablica opcji do kolejnej funkcji.
function search
($text, $tag = 'ol', array $options) {
$pattern = "#\<$tag\>(((?:[^<]|\<(?!/?$tag\>)|(?R)))*)\</$tag\>#";
$count = count($matches); if (null === $max0Levels)
{
$count = @count($matches[1
]) ?
: 0; $max0Levels = $count;
}
if (1 < $count)
{
for ($i = 0 ; $i < $count ; $i++)
{
{
if (false !== strstr($matches[1
][$i], $options['word'])) {
$max0Levels = null;
return searchBetween($matches[1][$i], $options['beforeWord'], $options['afterWord'], $options['debug']);
}
}
}
}
$max0Levels = null;
}
Ta druga funkcja wygląda natomiast tak:
function searchBetween($content, $start, $end, $debug = false)
{
// . \ + * ? [ ^ ] $ ( ) { } = ! < > | :
// - which was added in php 5.3, so maybe it's wise to add it anyway as a second parameter
$pattern = "/$start(.*)$end/";
return isset($matches[1
]) ?
$matches[1
] : $matches; }
A poniżej parę wywołań, by uzyskać dane, które chciałeś.
$r = search
($text, 'tr', array( 'word' => 'Zalogowany',
'beforeWord' => '<b><span class="gen">',
'afterWord' => '</span></b>',
'debug' => true
));
$r = search
($text, 'tr', array( 'word' => 'Diamenty',
'beforeWord' => '<a href="diamenty.php" style="color: #a4a4a4;">',
'afterWord' => '</a>',
'debug' => true
));
$r = search
($text, 'tr', array( 'word' => 'Poziom konta',
'beforeWord' => '<a href="diamenty.php" style="color: #a4a4a4;">',
'afterWord' => '</a>',
'debug' => true
));
$r = search
($text, 'tr', array( 'word' => 'Pochwały',
'beforeWord' => '<b><span class="gen">',
'afterWord' => '</span></b>',
'debug' => true
));
$r = search
($text, 'tr', array( 'word' => 'Ostrzeżenia',
'beforeWord' => '<b><span class="gen">',
'afterWord' => '</span></b>',
'debug' => true
));
Pamiętaj by struktura htmla była właściwa, tam w Twoim htmlu brakuje otwierającego
tr.