@georgimateev, $q = preg_replace("/^D+|D+$/", "", $q);
Apr 12 2009, 00:59