Don't believe SQL supports regex. Try this:
<?
$sql="SELECT key, field from $table where field like ('%#%')";
if ($result=pg_exec($conn, $sql))
while ($row=pg_fetch_array($result, $i++))
{
$field=str_replace($row[field], '#', '*');
$sql="UPDATE $table SET field='$field'
WHERE key=".$row[key];
pg_exec($conn, $sql);
}
?>
This is in Postgres, similar would work in MySQL.