Strange. That code works without problem on both of my local PC's as well as my hosted server. The code in question is actually on line 125 and should look as follows:
if (!empty($dbprefix)) {
if (!eregi('^(' .$dbprefix .')', $dbname)) {
// prefix may be different on different servers
$dbname = $dbprefix .$dbname;
} // if
} // if
Either you have a corrupt version of file dml.mysql.class.inc or you have something wrong with your PHP installation.
BTW, what value are you passing in for $dbprefix (from your config.inc file)?