ereg_replace?

hey all,
i’m exporting a list of all my mySQL databases using php and trying to write them to an xml file. However, my server adds townfre_ before the name of the database. I want to remove that from the name and leave the remainder of the database name to be written to the xml file. I’m using this:

 $file= fopen("states.xml", "w+");
 $_xml .="<towns>
";
 while ($row = mysql_fetch_array($db_list)) {
 if ($row['0']) {
  $_xml .= "<town name=\{ereg_replace("townfre_","","$row['0']")} />
";
  } 
}

but, obviously its not working. Anyone know how i can achieve what i want here?
Thanks,
Mat