Online Optimization in Dynamic Environments: A Regret Analysis for Sparse Problems