<?php
$threadurl = 'http://forums.rockbox.org/index.php?topic=26079.new';
preg_match('/.*topic=([0-9]*).*"/',
$threadurl, $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
?>