replaced deprecated ereg() with preg_match()