updated to remove deprecated ereg function